- Version: 6.2.2
- Operating System: any
- Config File (if you have sensitive info, please remove it):
output_mail.conf
output {
if "shouldmail" in [tags] {
email {
to => 'technical@example.com'
from => 'monitor@example.com'
subject => 'Alert - %{title}'
template_file => "/tmp/email_template.mustache"
domain => 'mail.example.com'
port => 25
}
}
}
email_template.mustache
<p>{{ [@meta][_type] }}</p>
<p>{{ [log][level] }}</p>
hash of the event:
{
"@meta: { "_type": "beats" },
"log": { "level": 3 },
"message": "Hello world!",
}
If we take this example, it's not possible to use the keys having special characters in the mustache template. This is annoying because it means we have to move/duplicate the meta keys/hash (for example), and re-delete them after.
The solution I propose would be to have a basic conversion of these, for example removing the brackets and special symbols, transforming @meta to meta for example.
In addition, mustache allows for dot notation to traverse hashes (for example log.level, which is nice). So it could help to traverse meta._type (I'm not sure about _ though).
Do you have any idea on this?
output_mail.conf
email_template.mustache
hash of the event:
If we take this example, it's not possible to use the keys having special characters in the mustache template. This is annoying because it means we have to move/duplicate the meta keys/hash (for example), and re-delete them after.
The solution I propose would be to have a basic conversion of these, for example removing the brackets and special symbols, transforming
@metatometafor example.In addition, mustache allows for dot notation to traverse hashes (for example
log.level, which is nice). So it could help to traversemeta._type(I'm not sure about _ though).Do you have any idea on this?