I have two set of environment consider as A and B. I have configured A env in logstash.conf and its working as expected but now I have to add B in the same file but I have to create different index for the A and B. How to achieve it?
I have gone through above link but the index is not working with the same.
Below is the logstash.conf I am using
<
input {
beats {
port => "5044"
}
}
filter {
if [fields][log_type] in [ "apache_access" , "apache-access" ] and [fields][application] == "application" and [fields][env] == "A" {
grok {
match => [
"message" , "%{IP:access-ip1} %{IP:access-ip2} - - [%{NOTSPACE:access-timestamp} +%{INT}] "%{WORD:access-httpmethod} %{NOTSPACE:access-request} %{WORD:access-protocol}/%{NUMBER:access-protocolversion}" %{INT:access-status} %{INT:access-responsesize} %{INT:access-responsetime} "-" "%{WORD} %{WORD} %{NOTSPACE}" [ %{WORD} %{WORD} %{WORD}= %{INT:access-responsetimeinmicrosec}%{GREEDYDATA}"
]
overwrite => [ "message" ]
}
output {
if [fields][log_type] in [ "apache_access" , "apache-access" ] and [fields][application] == "application" and [fields][env] == "A" {
elasticsearch {
...
index => "A"
}
} else {
elasticsearch {
...
index => "B"
}
}
}
/>
You can use interpolation in the index setting of the Elasticsearch output - meaning that some field or metadata field in your event holds part of the index name. So those events from "A" could have a field (add_field in beats input) called say index_suffix with value "a" and events from "B" have the same field with value "b".
Can you or someone please suggest how can we implement below scenario (master slave in logstash):
Create one A.conf for env A, create B.conf for env B with required filter and output details. And then will create one master.conf which will be having input configuration of logstash along with source of both env.conf over there. Is it possible to have this kind of configuration? and how can we achieve this?
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.