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

How to use eventTemplateAdditionalFields in log4j2.yaml

    XMLWordPrintableJSON

    Details

    • Type: Question
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.14.0
    • Fix Version/s: 3.0.0, 2.14.1
    • Component/s: Appenders
    • Labels:
      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

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: