HI.
I have two businesses that must be separated in two different indexes.
I'm trying to separate them on the output:
output {
if [region] == "au" {
elasticsearch {
hosts => ["localhost:9200"]
# Weekly index (for pruning)
index => "au-log-index-%{+YYYY.'w'ww}"
}
}
else {
elasticsearch {
hosts => ["localhost:9200"]
# Weekly index (for pruning)
index => "nz-log-index-%{+YYYY.'w'ww}"
}
}
stdout { codec => rubydebug }
}
I'm adding the region
field like this; example.conf
:
if [type] == "au_uat_apache_access_log" {
mutate {
replace => { 'host' => 'uatweb.datacentre.example.com.au' }
add_field => { 'environment' => 'uat'
'service' => 'apache_access'
'region' => 'au'
}
}
grok {
match => {
"message" => "%{IPORHOST:clientip}%{SPACE}\[%{HTTPDATE:timestamp}\]%{SPACE}%{NUMBER:port}%{SPACE}%{WORD:method}%{SPACE}%{URIPATHPARAM:request_uri}%{SPACE}%{NOTSPACE}%{SPACE}%{NUMBER:status_code}%{SPACE}%{NOTSPACE:bytes_delivered}%{SPACE}%{NUMBER:duration%}%{SPACE}(?:%{URI:referrer}|.*)%{SPACE}%{QS:agent}%{SPACE}%{GREEDYDATA:general_data}"
}
}
date {
match => ["timestamp", "dd/MMM/yyyy:HH:mm:ss Z"]
target => "@timestamp"
}
}
However from Kibana I am only able to see the nz*
index, which correspond to the else
statement.
What am I doing wrong? Thanks in advance.