Hello
I am trying to extract contents of the filename (made available by the sourcefield) and would like to add tags/create new fields based on the criterie.
For example if this was the data in the source field:
/app/appname/log/database-server-n5-server1234.domain.local.out
I would like to extract the following bits from the filename and create fields/tags for them:
instancenumber: "n5"
hostname: "server1234.domain.local.out"
I have tried the following but I keep getting config errors:
else if [type] == "AppCacheProxy" { grok { match => { "message" => "\A%{TIMESTAMP_ISO8601}%{NOTSPACE}%{SPACE}%{GREEDYDATA}" } match => { "@source_path", "app/appname/log/database-server-%{NOTSPACE:instancenumber}-%{NOTSPACE:hostname}.log" } break_on_match => false }
I also tried the following line in place of the one above:
match => { "source_path" => "app/appname/log/database-server-%{NOTSPACE:instancenumber}-%{NOTSPACE:hostname}.log" }
What is the best way to achieve this?
Regards