Logstash output log messages to multiple outputs simultaneously?

Is it possible for logstash to output a log message to multiple different outputs simultaneously? Something like this:

output {
  if [env] == "production" and [node] == "web101" {
    file {
      path => "/var/log/logstash/nodes/web101/access.log"
      codec => line { format => "%{message}" }
      create_if_deleted => true
      file_mode => 0640
     }
    file {
      path => "/var/log/logstash/production/apache/access.log"
      codec => line { format => "%{message}" }
      create_if_deleted => true
      file_mode => 0640
     }
  }

I need to have all the production apache logs go to one folder, all the logs for a particular server going to its own folder and I will probably also have a third folder for all the logs from a certain date. So there will be duplicate logs in multiple locations.

Yes, that configuration should be OK.

1 Like

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