Hi,
The log output like this:
{
"@timestamp" => 2019-09-19T17:30:48.984Z,
"characterid" => "20036815",
"inventory_item" => [
[ 0] {
"item_equipped" => true,
"item_count" => 1,
"item_type" => "1",
"item_id" => 102022
},
[ 1] {
"item_equipped" => true,
"item_count" => 1,
"item_type" => "3",
"item_id" => 23201
},
[ 2] {
"item_equipped" => false,
"item_count" => 1,
"item_type" => "2",
"item_id" => 910
},
[ 3] {
"item_equipped" => false,
"item_count" => 1,
"item_type" => "3",
"item_id" => 21400
},
[ 4] {
"item_equipped" => false,
"item_count" => 1,
"item_type" => "2",
"item_id" => 21401
},
[ 5] {
"item_equipped" => true,
"item_count" => 1,
"item_type" => "4",
"item_id" => 21402
}
]
}
I want to output like this, after filter:
{
"@timestamp" => 2019-09-19T17:30:48.984Z,
"characterid" => "20036815",
"inventory_item" => [
[ 0] {
"item_equipped" => true,
"item_count" => 1,
"item_type" => "1",
"item_id" => 102022
},
[ 1] {
"item_equipped" => true,
"item_count" => 1,
"item_type" => "3",
"item_id" => 23201
},
[ 2] {
"item_equipped" => true,
"item_count" => 1,
"item_type" => "4",
"item_id" => 21402
}
]
}
[inventory_item][item_equipped] != true
then will be remove.
I used ruby plugin. But it seems don't work.
ruby {
code => "
event.get('inventory_item').each do |item|
if item['item_equipped'] == false
event.remove('[#{item}]')
end
end
"
}
Do you have any suggtions?