I have data that is coming in via Logstash with ActiveMQ bus that looks like this:
"DataType1" => {
"system:subsystem123" => [
[0] {"field": "test}],
"system:subsystem234" => [
[0] { "field": "test"}],
"system:subsystem837" => [
[0] { "field": "test"}],
etc.
I am trying to extract data from DataType1. I want to move the contents of the array
[[0] { "field": "test"}], one level up to be on the same level as "system:subsystem123"
My output should look like:
{ "DataType1": [
{
"system:_subsystem": system101:subsystem123",
"field: test"
}
I have the following ruby:
ruby {
code =>
"event.get('DataType1').each { |e|
h = {}
h['system_subsystem'] = e.first
h.merge! e[1][0]
event.set([DataType1']) << h
}"
}
I am getting the following error:
Ruby exception occurred: wrong number of arguments calling set
(1 for 2)
Any advice?