filter {
if [message] =~ Regex
grok {
match => [PATTERNA]
}
filter {
if [message] =~ Regex
grok {
match => [PATTERNB]
}
If a messages matches both the regex for filter 1 and filter 2. But it fails to match the grok on PATTERNA, will it fail and exit here, or will it try PATTERNB in the second file?
If you do not have a insane EPS just do this with one config, make sure that you have proper anchoring ^ and $ in your patterns to do the efficient matching. You can sort your match expressions in the ordered list that the most matching ones will be placed on the top etc.
If you have insane amount of events per second you will get better performance by distributing your input.
You can try the following idea for pipeline to pipeline than:
input {
file {
path => "/your/file/log1.log"
start_position => "beginning"
codec => json
}
}
filter {
grok {
match { "message" => }#do some quick regex prefiltering in order to detect what is comming from where and distribute later
}
}
output {
if [log1_field]{
pipeline {
id => "YOUR_LOG1_PROCESSING_PIPELINE"
send_to => LOG1_PROCESSING
}
} else if [log2_field]{
pipeline {
id => "YOUR_LOG2_PROCESSING_PIPELINE"
send_to => LOG2_PROCESSING
}
} else {
pipeline {
id => "YOUR_LOG3_PROCESSING_PIPELINE"
send_to => LOG3_PROCESSING
}
}
}
You do the very light regex expressions in the distributor and your heavy processing on separate pipelines. I do not know any other idea than this or running kawka and multiple logstash nodes reading from the same topics and doing that loadbalancing.
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.