Reputation: 892
How do you pass temporary data from a filter to output in logstash?
filter {
mutate {
add_field => {"TEMP_DATA" => "%{some value}"}
}
}
output {
elasticsearch {
document_id => "%{TEMPDATA}"
}
}
The above will output the TEMPDATA value
Upvotes: 2
Views: 2655
Reputation: 217294
The correct and standard way of achieving this is by using the @metadata
field. @metadata
is a special field that will never be stored in your events but whose sole purpose is to pass data among your inputs, filters and outputs.
Sample usage:
filter {
mutate { add_field => { "[@metadata][TEMP_DATA]" => "%{some value}" } }
}
output {
elasticsearch {
document_id => "%{[@metadata][TEMP_DATA]}"
}
}
Upvotes: 5