Hi,
In my output section, i have multiple conditions. Each conditions alows me to route one type of log in the correct Elasticsearch indexe.
This is my logstash output :
> output {
> if "nginx" in [tags] {
> if "_grokparsefailure" not in [tags] {
> elasticsearch {
> hosts => ["10.1.101.1", "10.1.102.1", "10.1.103.1"]
> index => "logstash-isg-%{+YYYY.MM.dd}"
> }
> }
> }
> else if "scarlette" in [tags] {
> if "_grokparsefailure" not in [tags] {
> elasticsearch {
> hosts => ["10.1.101.1", "10.1.102.1", "10.1.103.1"]
> index => "logstash-scarlette-%{+YYYY.MM.dd}"
> }
> }
> }
> else if "serveur_owncloud" in [tags] {
> if "_grokparsefailure" not in [tags] {
> elasticsearch {
> hosts => ["10.1.101.1", "10.1.102.1", "10.1.103.1"]
> index => "logstash-owncloud-%{+YYYY.MM.dd}"
> }
> }
> }
> else if "brouette" in [tags] or "poussette" in [tags] {
> if "_grokparsefailure" not in [tags] {
> elasticsearch {
> hosts => ["10.1.101.1", "10.1.102.1", "10.1.103.1"]
> index => "logstash-mta-%{+YYYY.MM.dd}"
> }
> }
> }
> else if "serveur_proxy" in [tags] or "serveur_dns" in [tags] {
> if "_grokparsefailure" not in [tags] {
> elasticsearch {
> hosts => ["10.1.101.1", "10.1.102.1", "10.1.103.1"]
> index => "logstash-proxydns-%{+YYYY.MM.dd}"
> }
> # file {
> # path => "/var/log/LS-redis-flux.log"
> # }
> }
> }
> }
The spécified indexes are created, and they do contain the log i want.
But Logstash continue to create it's default indexe "logstash-", and this indexe contain a copy of each log. One log is in "logstash-" and the other is in the correct indexe.
This seems strange to me, because i always specifies the name of the indexe. in my logstash output conditions. I don't know why this indexe is created and why logs are copied into it.