How to represent logstash output in proper json format
event name represents station name, event id represent station id.
How can i combine them to get proper json data
My conf file:
input {
file {
path => "D:/ELK-stack/stations.xml"
start_position => "beginning"
sincedb_path => "NUL"
codec => multiline {
pattern => "|"
negate => true
what => "previous"
auto_flush_interval => 1
}
}
}
filter {
if [message] == "" or [message] == "" {
drop {}
}
xml {
source => "message"
target => "message.parsed"
xpath => [
"/stations/station/id/text()", eventid ,
"/stations/station/name/text()", eventname
]
force_array => false
}
}
output {
stdout { codec => rubydebug }
}
My Xml file:
.stations>
.\station>
.id>5 ./id>
.name>Aurora Hills Community Ctr/18th - Hayes St . /name>
./station>
.station>
.id>6
.name>Pentagon City Metro / 12th - S Hayes St ./name>
./station>
./stations>
Please help me