hi
I'm trying to replace my log time with @timestamp but it doesn't work.
my log sample: 2019-07-08 01:00:13,564 INFO ir.ac.ut.sdrwebservice.SDRWebService @ batchAddStdDoc, System:G, User:25117, StudentIDs:[450188215], GroupID:4501, DocType:1349, returned 1562531413462298
and here is my logstash config:
input {
beats {
client_inactivity_timeout => 1200
port => 5044
}
}
filter {
if ([message] !~ /batchAddStdDoc/) {
drop { }
}
if ([message] !~ /returned/) {
drop { }
}
grok {
match => { "message" => "%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day} %{HOUR:hour}:%{MINUTE:minute}:%{SECOND:second},%{INT:milisecond} %{LOGLEVEL:loglevel} %{NOTSPACE:webService} @ %{NOTSPACE:function}, System:(?<systemName>.), User:%{NOTSPACE:userId}, StudentIDs:\[%{NUMBER:studentId}\], GroupID:%{GREEDYDATA:groupId}, DocType:%{NOTSPACE:docType}, returned %{INT:returnedCode}" }
}
date {
locale => "en"
match => ["message", "yyyy-MM-dd HH:mm:ss,SSS"]
timezone => "Asia/Tehran"
target => "@timestamp"
add_field => { "debug" => "timestampMatched"}
}
}
output {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
#user => "elastic"
#password => "changeme"
}
}
thanks Badger.
my logs has 2 space there but I don't know why it's not visible here!
finally, I solved It. my filter was OK and I need to change time range because my logs were at least for two days ago and I was looking for them in today time range in Kibana.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.