Hi- I'm having some trouble using a date filter in logstash. I am able to parse the date elements from the original log message into a custom field, but the date filter does not assign it to the @timestamp
field and I don't understand why not. I am not getting _dateparsefailure
tags in the output, either, so I'm befuddled.
Here's my logstash configuration:
input {
file {
path => "/home/netaffx/wl-proxy.*.log"
type => "wl-proxy-log"
start_position => "beginning"
}
}
filter {
if [type] == "wl-proxy-log" {
grok {
match => {
"message" => [
"%{DATA}\s+\[%{WORD:method}\s+%{URIPATH:uri_path}%{URIPARAM:uri_params}?\s+%{URIPROTO:uri_proto}/%{BASE10NUM:proto_version}\]\s+%{GREEDYDATA}\n?",
"(%{DAY}\s+)?(?<syslog_datetime>%{SYSLOGTIMESTAMP}\s+%{YEAR})\s+<%{INT:session_id}>\s+(?<log_message>ap_unescape_url return success. Using tempQueryStr =\s+{GREEDYDATA:uri_params})\n?",
"(%{DAY}\s+)?(?<syslog_datetime>%{SYSLOGTIMESTAMP}\s+%{YEAR})\s+<%{INT:session_id}>\s+%{GREEDYDATA:log_message}\n?",
"(%{DAY}\s+)?(?<syslog_datetime>%{SYSLOGTIMESTAMP}\s+%{YEAR})\s+<%{INT:session_id}>\s+%{DATA}\s+\[%{URIPATH}%{URIPARAM:uri_params}\]\n?"
]
}
break_on_match => true
}
date {
match => [ "syslog_datetime[0]", "MMM dd HH:mm:ss yyyy", "MMM d HH:mm:ss yyyy" ]
locale => "en-US"
timezone => "America/Los_Angeles"
target => "@timestamp"
}
kv {
source => "uri_params"
field_split => "&?"
}
}
}
output {
if [type] == "wl-proxy-log" {
elasticsearch {
ssl => false
index => "wl-proxy"
manage_template => false
}
}
}
Here is the JSON that results from that:
{
"_index": "wl-proxy",
"_type": "wl-proxy-log",
"_id": "gL7He2ABNapjGXAZJiUn",
"_version": 1,
"_score": null,
"_source": {
"path": "/home/netaffx/wl-proxy.ws8-prod.colo.log",
"@timestamp": "2017-12-22T01:12:16.713Z",
"syslog_datetime": "Sep 29 16:23:40 2016",
"@version": "1",
"host": "na6.affymetrix.com",
"session_id": "6249147519142051",
"log_message": "request [/publications/full_list.affx?year=2006&result_page=23] processed sucessfully..................",
"message": "Thu Sep 29 16:23:40 2016 <6249147519142051> request [/publications/full_list.affx?year=2006&result_page=23] processed sucessfully..................",
"type": "wl-proxy-log"
},
"fields": {
"@timestamp": [
"2017-12-22T01:12:16.713Z"
]
},
"sort": [
1513905136713
]
}
I think that the issue may be related to the parsed field being a string, and the field that I am trying to assign it to is a datetime, but I haven't been able to establish that and the documentation seems to indicate that the date filter, if it is parsing the field correctly, will output a value that is compatible with a date field.
Can anyone help with this? Thanks in advance!