How to use includes in Logstash conf files

Can includes be used in logstash config files?

Minimal, Complete, and Verifiable Example

Can I replace this...

file: beats.conf

input {
  beats {
    port => 5044
  }
}
filter {
    date {
        match => ["myTimestamp", "yyyyMMdd_HH:mm:ss.SSS"]
        target => "date_time"
    }
}
output {
  elasticsearch {
    hosts => [ "localhost:9200" ]
  }
}

...with this?

file: date.inc

date {
    match => ["myTimestamp", "yyyyMMdd_HH:mm:ss.SSS"]
    target => "date_time"
}

file: beats.conf

input {
  beats {
    port => 5044
  }
}
filter {
    #include <date.inc>  // <- THIS THIS THIS THIS THIS
}
output {
  elasticsearch {
    hosts => [ "localhost:9200" ]
  }
}

There is no concept of include files in Logstash so I am not sure where you got that from. If you read config from a directory you can split config into multiple files that are concatenated, but you there has to specify full blocks. You can also organize your config into multiple distinct pipelines which you cansend data between.

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