Using Filters for problematic log
Posted: Thu Dec 15, 2016 8:51 am
I am trying to create a grok filter that works for a log we are trying to pull into our system.
Issue 1: The issue is the logfile outputs logs like this "Data1|Data2|Data3|" which prevents us from grabbing a couple pieces of information. So, I followed the instructions here to try and replace that | character with a space.
http://stackoverflow.com/questions/2476 ... terns-file
That makes sense to me. I tried to apply it in our filter and I am getting a configuration error. This is what I have:
The second part of the filter is one where I am trying to get the date output into a single timestamp. Here is an example of the timestamp in the log:
Dec 13 2016 14:25:00
I tried all the timestamp patterns I could find, but not would pull in the full field. So I tried creating a pattern, which worked fine on grokconstructor. I then tried to apply it like this. I haven't been able to thoroughly test this yet as the above piece is not working yet. But I wanted to verify how this would be used.
Issue 1: The issue is the logfile outputs logs like this "Data1|Data2|Data3|" which prevents us from grabbing a couple pieces of information. So, I followed the instructions here to try and replace that | character with a space.
http://stackoverflow.com/questions/2476 ... terns-file
That makes sense to me. I tried to apply it in our filter and I am getting a configuration error. This is what I have:
Code: Select all
if [type] == 'WAF' {
mutate {
gsub => ["message","\|"," "]
}Dec 13 2016 14:25:00
I tried all the timestamp patterns I could find, but not would pull in the full field. So I tried creating a pattern, which worked fine on grokconstructor. I then tried to apply it like this. I haven't been able to thoroughly test this yet as the above piece is not working yet. But I wanted to verify how this would be used.
Code: Select all
grok {
match => ["WAF_TIMESTAMP", "%{MONTH} %{DATA} %{YEAR} %{TIME}"]
match => ['message', %{GREEDYDATA} %{DATA:Device} %{DATA:Model} %{WAF_TIMESTAMP:Timestamp} ....