I did it and it is not working. I am not getting the final event.
Just Need to mention that I am running version 6.6.0 on windows machine.
My Input file: (foo.json)
{ "PROBLEM" : 100 }
{ "PROBLEM" : 101 }
{ "PROBLEM" : 102 }
{ "PROBLEM" : 103 }
{ "PROBLEM" : 104 }
{ "PROBLEM" : 105 }
{ "PROBLEM" : 106 }
Input:
input {
file {
path => "C:/kpi/foo.json"
start_position => "beginning"
sincedb_path => "NUL"
}
}
My filter:
filter {
if [path] == "C:/kpi/foo.json"
{
json { source => "message" }
aggregate {
task_id => "%{PROBLEM}"
code => "
map['FooJustTesting'] ||= 0; map['FooJustTesting'] += 1
"
push_map_as_event_on_timeout => true
inactivity_timeout => 2
}
}
}
My output:
output {
if [path] == "C:/kpi/foo.json"
{
stdout{}
}
}
The stdout results:
{
"host" => "SHARONSA03",
"message" => "{ \"PROBLEM\" : 100 }\r",
"@timestamp" => 2019-02-21T14:02:00.457Z,
"path" => "C:/kpi/foo.json",
"@version" => "1",
"PROBLEM" => 100
}
{
"host" => "SHARONSA03",
"message" => "{ \"PROBLEM\" : 104 }\r",
"@timestamp" => 2019-02-21T14:02:00.522Z,
"path" => "C:/kpi/foo.json",
"@version" => "1",
"PROBLEM" => 104
}
{
"host" => "SHARONSA03",
"message" => "{ \"PROBLEM\" : 102 }\r",
"@timestamp" => 2019-02-21T14:02:00.521Z,
"path" => "C:/kpi/foo.json",
"@version" => "1",
"PROBLEM" => 102
}
{
"host" => "SHARONSA03",
"message" => "{ \"PROBLEM\" : 103 }\r",
"@timestamp" => 2019-02-21T14:02:00.522Z,
"path" => "C:/kpi/foo.json",
"@version" => "1",
"PROBLEM" => 103
}
{
"host" => "SHARONSA03",
"message" => "{ \"PROBLEM\" : 101 }\r",
"@timestamp" => 2019-02-21T14:02:00.518Z,
"path" => "C:/kpi/foo.json",
"@version" => "1",
"PROBLEM" => 101
}
{
"host" => "SHARONSA03",
"message" => "{ \"PROBLEM\" : 105 }\r",
"@timestamp" => 2019-02-21T14:02:00.523Z,
"path" => "C:/kpi/foo.json",
"@version" => "1",
"PROBLEM" => 105
}
{
"host" => "SHARONSA03",
"message" => "{ \"PROBLEM\" : 106 }\r",
"@timestamp" => 2019-02-21T14:02:00.523Z,
"path" => "C:/kpi/foo.json",
"@version" => "1",
"PROBLEM" => 106
}
Thanks
Sharon.