Sample log -
IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION
C6E26F3B 1002042417 I H hdisk111 BACK-UP PATH STATUS CHANGE
C6E26F3B 1002042417 I H hdisk103 BACK-UP PATH STATUS CHANGE
Config File -
input {
file {
path => "/home/elkuser/KP/LogData/errpt/server_lun_info1.log"
#path => "/home/elkuser/KP/LogData/errpt/errpt1.log"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter
{
grok { # match => [ "message", "\A%{HOSTNAME:IDENTIFIER}%{SPACE}+%{NUMBER:TIMESTAMP}%{SPACE}+%{PROG:T}%{SPACE}+%{PROG:C}%{SPACE}+%{PROG:TIMESTAMP}%{SPACE}+%{GREEDYDATA:DESCRIPTION}" ]
match => [ "message", "\A%{PROG:IDENTIFIER}%{SPACE}+%{NUMBER:TIMESTAMP}%{SPACE}+%{NOTSPACE:T}%{SPACE}+%{NOTSPACE:C}%{SPACE}+%{NOTSPACE:RESOURCE_NAME}%{SPACE}+%{GREEDYDATA:DESCRIPTION}" ]
overwrite => [ "message" ]
}
mutate {
convert => {"TIMESTAMP" => "integer"}
}
date{ match => [ "TIMESTAMP", "MMddHHmmyy" ]
target => "TIMESTAMP"
}
#date_formatter {
source => "TIMESTAMP"
target => "timestamp1"
pattern => "MM/DD/YY HH:mm"
# locale => "fr-FR"
timezone => "PST"
#}
}
output {
elasticsearch {
hosts => "localhost"
index => "kp-epims-errpt"
index => "kp-epims-errpt1"
template_overwrite => true
}
stdout {
codec => rubydebug
}
}
Error Message
"path" => "/home/elkuser/KP/LogData/errpt/server_lun_info1.log",
"@timestamp" => 2017-11-08T19:38:47.818Z,
"C" => "S",
"T" => "T",
"DESCRIPTION" => "SOFTWARE PROGRAM ERROR",
"TIMESTAMP" => 1001234217,
"@version" => "1",
"host" => "analyticslab72.in.ibm.com",
"IDENTIFIER" => "DC73C03A",
"message" => "DC73C03A 1001234217 T S fscsi0 SOFTWARE PROGRAM ERROR",
"RESOURCE_NAME" => "fscsi0",
"tags" => [
[0] "_dateparsefailure"
]
- trying to match MMddHHmmyy and getting dateparse failure.
- from MMddHHmmyy trying to convert to another format MM/dd/yy HH:mm using date_formatter and not able to do so.
- how to convert date from one format to the required format.
Please advise.
Thanks!