Hello Everyone,
I am newbie in ELK stack and i am still learning the logstash, kibana and its further uses . Currently i am stuck at a point where i want to extract the time stamp from my logs and replace it with @timestamp of the kibana dashboard . I have seen there are various other people who faced the same issue but none of their solution seem to be working for me .
Here is the grok filter that i am using for my logs
filter {
if [fields][Component] == "Campaign Director" {
grok {
match => {
'message' => '(?<LogLevel>[%{WORD}]+)([-])?(?<Category>[%{WORD}]+)? (?<TimeStamp>%{MONTHDAY:Day} %{MONTH:Month} %{YEAR:Year} %{HOUR}:%{MINUTE}:%{SECOND}\.%{WORD:Milliseconds}) \[%{DATA:ThreadName}\|%{DATA:ClassName}\.%{DATA:FunctionName}(:%{NUMBER:LineNumber})?] *- %{GREEDYDATA:LogMessage}'
}
}
date {
match => ["timestamp", "dd MMM yyyy HH:mm:ss.SSS"]
target=>@timestamp
}
mutate {
add_field => {
Component => "%{[fields][Component]}"
}
gsub => ["Category", "TSK", "TASKS"]
gsub => ["Category", "RST", "REST"]
gsub => ["Category", "ZNE", "ZONES"]
gsub => ["Category", "DSH", "DASHBOARD"]
gsub => ["Category", "HST", "HISTORY"]
gsub => ["Category", "SCD", "SCHEDULES"]
gsub => ["Category", "IMP", "IMPORT"]
gsub => ["Category", "CLP", "CLEANUP"]
gsub => ["Category", "TSK", "TASK"]
gsub => ["Category", "ENTEXT", "ENTRYEXIT"]
gsub => ["Category", "IMPVRB", "IMPORTVERBOSE"]
gsub => ["LogLevel", "FST", "FINEST"]
gsub => ["LogLevel", "FNR", "FINER"]
gsub => ["LogLevel", "FNE", "FINE"]
gsub => ["LogLevel", "IFO", "INFO"]
gsub => ["LogLevel", "WRN", "WARN"]
gsub => ["LogLevel", "FTL", "FATAL"]
gsub => ["LogLevel", "ERR", "ERROR"]
gsub => ["Component", "CmpDir", "Campaign Director"]
}
}
}
This is my sample log
FST-SCD 11 Dec 2022 07:39:50.527 [Cleanup-Thread|CleanupThread.cleanDanglingSchedules:] - CleanDanglingSchedules - inside for loop index=1, TriggerName=Trigger1, TriggerState=NORMAL
Currently it is showing the current date on the @timestamp field and not the log date
Any help would be appreciated . Thanks Everyone