Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2995

How to use eventTemplateAdditionalFields in log4j2.yaml

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Question
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.14.0
    • 3.0.0, 2.14.1
    • Appenders
    • None

    Description

      Hi,

      I am struggling to find a way, how exactly to write the syntax in yaml to be able to use 

      EventTemplateAdditionalFields in JsonTemplateLayout. You don't provide any example on your website and nothing I have tried works. My current config looks like this:

      Configuration:
      
        Appenders:
          Console:
            name: LogToConsole
            target: SYSTEM_OUT
            JsonTemplateLayout:
              eventTemplateUri: classpath:LogstashJsonEventLayoutV1.json
              stackTraceEnabled: true
              maxStringLength: 32768
              EventTemplateAdditionalFields:
                EventTemplateAdditionalField:
                  - key: service
                    value: profiles-profile-service
      
        Loggers:
          Root:
            level: info
            AppenderRef:
              ref: LogToConsole
      

       
      Could you please help?

      Best Regards,
      Michal Stefan
       

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            vy Volkan Yazici
            michal.stefan.ext@gmail.com Michal Stefan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment