I created an logstash input plugin in jruby and when I do an @logger.info("log entry"), I'd like it to have a pipeline.id in the logstash-plain.log as generated by log4j2. Since I have several pipelines it's nice to use the pipeline.id variable. I can configure an id in the configuration input block or use the internal @id, but is the pipeline.id exposed to the plugin and/or log4j2?
This question is a bit similar to
But since I wrote the plugin I can do @logger.info(@id). When I run logstash from the commandline and not as ubuntu service the @id does get printed as "main"
So the pipeline_id is not exposed to the plugin, but since it's part of the thread name, I can extract it from there. I can cut out the pipeline.id from between the [ and ], because the threadname is in the format
[pipeline.id]<plugin.name
For the configuration in log4j2.properties the threadname can be printed with %t, so it will look like this
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.