Hey folks,
I'm trying to use the email output to send an alert including a file attachment using something like the following:
email { |
...
body => "%{message}" |
attachments => ["%{email_attachment}"] |
} |
where "email_attachment" is a field with the path to a file on the logstash machine (something like "/tmp/file.tmp"). However when I actually try this out I get the following error:
Errno::ENOENT: No such file or directory - /Users/cjdimaggio/Downloads/sys/logstash-2.1.1/%{email_attachment}
which shows that the variable hasn't been interpolated into the string. I've tried changing the format a dozen different ways but to no avail. But I don't think that's even the problem; I've tested it out with mutate's add_tag, which similarly accepts an array, using:
mutate { | ';
add_tag => ["%{email_attachment}"] |}
}
and sure enough that adds the appropriate tag:
"tags" => [
[0] "/tmp/file.tmp"
]
Is there something fundamental I'm missing? Are there just some config options that can't be dynamically filled? I see that in the documentation there are some fields that explicitly say "You can also use dynamic fields from the event with the %{fieldname} syntax." but then there are others that don't make that specification and still work. I also don't see anything in the email output's source code that would lead to that distinction. Any advice?