Hello,
we have a log line that we want to parse with Logstash that looks like this:
from=<noreply@xxx.de> to=<max.muster@abc.de> to=<fabian.muster@def.de> to=<hamid.muster@ghi.de>
To parse this line, we use the Logstash key-value Filter:
kv {
source => "postfix_keyvalue_data"
trim_value => "<>,"
prefix => "postfix_"
remove_field => [ "postfix_keyvalue_data" ]
}
The result in Elasticsearch is what we expect:
"postfix_to": [
"max.muster@abc.de",
"fabian.muster@def.de",
"hamid.muster@ghi.de"
],
"postfix_from": "noreply@xxx.de"
Now we want in a separate field from every e-mail with only the domain.
The following should be added to the document:
"postfix_to_domain": [
"abc.de",
"def.de",
"ghi.de"
],
"postfix_from_domain": "xxx.de"
We've tried this to implement with the dissect filter:
dissect {
mapping => {
"postfix_from" => "%{}@%{postfix_from_domain}"
"postfix_to" => "%{}@%{postfix_to_domain}"
}
}
But the dissect filter doesn't iterate over the array. The result looks horrible:
"postfix_to_domain": "abc.de\", \"fabian.muster@def.de\", \"hamid.muster@ghi.de\"]",
"postfix_from_domain": "xxx.de"
Is it possible to iterate with the dissect filter or with grok or something else over an array and treat each value individually?
Thank you
Joel