Common config for file input plugins

(Mayank Agrawal) #1


Can I have common config for all the file input plugins in logstash configuration file ?


  file {
	  type => "abc"
      path => "C:/user/logs/*abc.log*"
      sincedb_path => "C:/user/logs/abc.sincedb"	

  file {
	  type => "xyz"
      path => "C:/user/logs/*xyz.log*"
      sincedb_path => "C:/user/logs/xyz.sincedb"	

   codec => multiline {
       pattern => "^%{TIMESTAMP_ISO8601}"
       negate => true
       what => previous

   start_position => beginning 
   ignore_older => 0 

Here, I want to have codec plugin and settings start-position , ignore-older common for all the file inputs.

If above mentioned config is wrong, then can there be any other way of doing so?

(Guy Boertje) #2

This is not possible. All sections in the input {} are parsed independently and handed to a new instance of each plugin (file in this case) for validation. There is no way to merge a common block into a specialised block.

You could look into using something like Mustache to "inject" your common sections into the final LS config file. The common sections could be a JSON or YAML file loaded before the Mustache file is rendered.

(system) #3

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