I expected it to become a filter if I mutate it after applying a filter to the json type.
I was using jdbc input
postgres some_column type is jsonb type
Dataset
some_column: {
id: 1,
type: "some",
name: "name"
}
I was trying to
filter {
json {
source => "some_column"
}
mutate {
add_field => {
"[some_column][name]" => "some_column_name"
"[some_column][id]" => "some_column_id"
}
remove_field => ["some_column"]
}
}
Logstash throw this error
Sep 24 08:20:05 ip-172-31-39-95 logstash[60415]: [2022-09-24T08:20:05,028][WARN ][logstash.filters.mutate ][main][6b5bfecfc90257b9d235f6af6be2c9cef079a5ab89f59bf98b51f017841e4465] Exception caught while applying mutate filter {:exception=>"Could not set field 'name' on object '' to value 'some_column_name'.This is probably due to trying to set a field like [foo][bar] = someValuewhen [foo] is not either a map or a string"}
I want to save only the necessary values in the json field and delete the some_column field, how do I do that?