Reputation: 1036
Logstash is receiving a json input from filebeat. It then parses the json.
filter {
json {
source => "message"
target => "data"
}
}
This data then goes to elastic search. All which works perfectly.
Now I need to convert some of the json fields.
e.g. data.body_bytes_sent must be converted to an integer.
I know there is a convert in logstash which converts fields:
filter {
mutate {
convert => { "msgSubmissionTime" => "integer" }
}
}
But how do I tell it to convert a field in the parsed json object?
Upvotes: 1
Views: 1933
Reputation: 1036
This worked:
filter {
json {
source => "message"
target => "data"
}
mutate {
convert => {"[data][body_bytes_sent]" => "integer"}
convert => {"[data][bytes_sent]" => "integer"}
}
}
Upvotes: 1