logback LogstashSocketAppender在输出中包含环境变量

时间:2018-02-07 20:15:12

标签: logstash logback

使用logback LogstashSocketAppender 时,是否可以在json输出中包含环境变量的值?

e.g。如何在每条日志消息中包含名为FOO的环境变量的值?它看起来像这样吗?

<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>

1 个答案:

答案 0 :(得分:0)

你在这里

<appender name="SOCKET" class="net.logstash.logback.appender.LogstashSocketAppender"> <host>127.0.0.1</host> <port>1511</port> <customFields> { "foo": "???" } </customFields> </appender>

See here for reference