Hi, I want to find if grok pattern is matched or not.
If pattern is matched then add one new field in given json else ignore to output it .
here is my input json
{
"type": "dmesg",
"hostName": "ramesh-nagargoje",
"os": "windo",
"bseid": 1234,
"logs": "[ 0.000000] Initializing cgroup subsys cpuset\n[ 0.000000] Initializing cgroup subsys cpu\n[ 0.000000] Initializing cgroup subsys cpuacct\n[ 0.000000] Linux version 3.13.0-144-generic (buildd@lgw01-amd64-059)"
}
Here is my filter
filter
{
if [type] == 'dmesg'
{
grok
{
match => { [logs] => "Initializing cgroup subsys" }
add_field => {"tag"=>"tagname1"}
}
grok
{
match => { [logs] => "Linux version" }
add_field => {"tag"=>"tagname2"}
}
}
}