How to reuse Logstash codec or pattern definition? -


background

currently in logstash configuration, have like:

input {   file {     type => "catalina-out"     path => [ "/var/tomcat/logs/catalina.out"]     sincedb_path => "$home/.sincedb"     tags => ["tomcat", "catalina-out"]     codec => multiline {       pattern => "(^.+exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*caused by:.+)|(%{loglevel}: %{greedydata})"     => "previous"     }   } ... 

what i'm trying accomplish

i have lots of tomcat output files, , reuse codec (or, less optimally, pattern) other file definitions.

the problem

my problem following gives me error:

input {    tomcat_multiline_codec => multiline {     pattern => "(^.+exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*caused by:.+)|(%{loglevel}: %{greedydata})"     => "previous"   }    file {     type => "catalina-out"     path => [ "/var/tomcat/logs/catalina.out"]     sincedb_path => "$home/.sincedb"     tags => ["tomcat", "catalina-out"]     codec => tomcat_multiline_codec   } ... 

the question

how can define codec (or if necessary, pattern) once, separately file block can reuse in other file blocks?

this isn't supported. logstash doesn't have general-purpose variables. unless can use multiline filter best bet use configuration management system templating support generate , deploy logstash configuration files. shouldn't maintaining them hand anyway.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -