filter { #If log line contains tab character followed by 'at' then we will tag that entry as stacktrace
if [message] =~ "\tat" {
grok {
match => {
"message" => ["^(\tat)"]
}
add_tag => ["stacktrace"]
}
}
Hi Len Rugen,
I cant see index infoindexer, debugindexer and errorindexerin in Kibana which I mentioned in logstash.conf. So I couldn't create them.
Even I have put some logs for INFO, DEBUG and ERROR in input logs file. But In Logstash console nothing is appearing to send to ElasticSearch.
I would take baby steps as your logstash.conf have multiple things
Step1: Just create the inputs and no filter, just put it to the elasticsearch "infoindexer"
Step2: if above works, then put the filters one by one and see it all comes to "infoindexer"
Step3: if above works, then put the full blown logic
I always like to build things up rather than putting all the configs at the start itself and then debug.
Even I was following same but after your comment i followed it with more focus and now I'm able to achieve what i wanted.
My config looks like:
input {
beats {
port => 5044
}
}
input {
file {
type => "java"
path => "C:/ELK/ProjectsLogs/spring-boot-elk.log"
start_position => "beginning"
codec => multiline {
pattern => "^%{TIMESTAMP_ISO8601}"
negate => "true"
what => "previous"
}
}
}
filter {
#If log line contains tab character followed by 'at' then we will tag that entry as stacktrace
if [message] =~ "\tat" {
grok {
match => { "message" => ["^(\tat)"]}
add_tag => ["stacktrace"]
}
}
grok {
match => { "message" => [ "%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:loglevel} %{GREEDYDATA:message}" ] }
match => { "message" => [ "%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:loglevel} %{GREEDYDATA:message}" ] }
add_field => { "subType" => "%{loglevel}" }
}
if "_grokparsefailure" in [tags] {
drop {}
}
}
filter {
mutate {
lowercase => ["subType"]
}
}
output{
elasticsearch {
hosts => ["localhost:9200"]
index => "%{subType}_indexer"
}
stdout {
codec => rubydebug
}
}
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.