LogstashSocketAppender include environment variable in output

Can you include the value of an environment variable in the json output when using the LogstashSocketAppender?

e.g. How would I include the value of an environment variable named FOO with every log message? Would it look something like this?

<appender name="SOCKET" class="net.logstash.logback.appender.LogstashSocketAppender">
  <host>127.0.0.1</host>
  <port>1511</port>
  <provider class="net.logstash.logback.composite.loggingevent.LoggingEventPatternJsonProvider">
    <pattern>
      {
      "foo": "???"
      }
    </pattern>
  </provider>
</appender>

p.s. Also posted the question at stackoverflow: https://stackoverflow.com/questions/48672503/logback-logstashsocketappender-include-environment-variable-in-output

Thanks.

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