Multiple logs to different index - Filebeat

I have in one filebeat.yml two paths for two different logs and it works fine but I need to divide to two index.
I tried as below:

- type: log
  enabled: true
    - /var/log/nginx/*.log
    type: "nginx"

- type: log
  enabled: true
    - /var/log/app/*.log
    type: "app"

Elasticsearch template setting:
  index.number_of_shards: 4 "nginx"
setup.template.pattern: "nginx-*" "app"
setup.template.pattern: "app-*"
setup.ilm.enabled: false

and in Elasticsearch output:
index: "nginx-%{+yyyy.MM.dd}-%{[fields.type]:nginx}"
index: "nginx-%{+yyyy.MM.dd}-%{[fields.type]:app}"

But is something wrong.
In Elastic I can create nginx index, can't create app index and still logs are from two paths.
I would be grateful for your advice.

Take a look at the example conditional output here for how to do what you want - Filebeat conditional output logstash

Also, please format your code/logs/config using the </> button, or markdown style back ticks. It helps to make things easy to read which helps us help you :slight_smile:

Thanks, but still I don't know how to implement in my config. This example is quite different that my case. I need to have in gui two spaces with different logs from one filebeat.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.