You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Martin Schröder (Jira)" <ji...@apache.org> on 2021/12/14 10:48:00 UTC

[jira] [Updated] (LOG4J2-3225) Syslog appender: syslogtag contains pid of process

     [ https://issues.apache.org/jira/browse/LOG4J2-3225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Schröder updated LOG4J2-3225:
------------------------------------
    Description: 
We have recently upgrade our projects from 2.8.2 to 2.15.0

We use the syslog appender with this configuration:

        <Syslog name="syslog" format="RFC5424" host="localhost" port="514" protocol="UDP"
                appName="herodotus" mdcId="mdc" includeMDC="true" facility="LOCAL0" connectTimeoutMillis="100" ignoreExceptions="false">
            <LoggerFields>
                <KeyValuePair key="class" value="%c{1.}"/>
                <KeyValuePair key="exception" value="%ex{full}"/>
            </LoggerFields>
        </Syslog>

This is then forwarded to a log host via rsyslog.

Config on the sender:

$ModLoad imudp
$UDPServerRun 514
#
if $syslogfacility-text == 'LOCAL0' then {
        @magpie;RSYSLOG_SyslogProtocol23Format
        stop
        }

Config on the receiver:

module(load="mmpstrucdata")
action(type="mmpstrucdata")

$template java_messages, "/var/log/techonair/%syslogtag%/messages"
template(name="herodotus" type="string"
  string="%timereported:::date-rfc3339% %syslogseverity-text:::uppercase% requestId[%$!rfc5424-sd!mdc@18060!requestId%] : %msg% : {%syslogtag%@%hostname%} {Class:%$!rfc5424-sd!mdc@18060!class%} %$!rfc5424-sd!mdc@18060!exception%\n")
if $syslogtag startswith 'herodotus' then {
        ?java_messages;herodotus
        stop
        }

Since 2.15.0 the created directory name contains the PID of the sending process, e.g. herodotus[5891]. This is not wanted and a regression from 2.8.2, where it was only the application name _without the PID_.

  was:
We have recently upgrade our projects from 2.8.2 to 2.15.0

We use the syslog appender with this configuration:

{{        <Syslog name="syslog" format="RFC5424" host="localhost" port="514" protocol="UDP"
                appName="herodotus" mdcId="mdc" includeMDC="true" facility="LOCAL0" connectTimeoutMillis="100" ignoreExceptions="false">
            <LoggerFields>
                <KeyValuePair key="class" value="%c{1.}"/>
                <KeyValuePair key="exception" value="%ex{full}"/>
            </LoggerFields>
        </Syslog>
}}

This is then forwarded to a log host via rsyslog.

Config on the sender:

{{$ModLoad imudp
$UDPServerRun 514
#
if $syslogfacility-text == 'LOCAL0' then {
        @magpie;RSYSLOG_SyslogProtocol23Format
        stop
        }}}

Config on the receiver:

{{module(load="mmpstrucdata")
action(type="mmpstrucdata")

$template java_messages, "/var/log/techonair/%syslogtag%/messages"
template(name="herodotus" type="string"
  string="%timereported:::date-rfc3339% %syslogseverity-text:::uppercase% requestId[%$!rfc5424-sd!mdc@18060!requestId%] : %msg% : {%syslogtag%@%hostname%} {Class:%$!rfc5424-sd!mdc@18060!class%} %$!rfc5424-sd!mdc@18060!exception%\n")
if $syslogtag startswith 'herodotus' then {
        ?java_messages;herodotus
        stop
        }}}

Since 2.15.0 the created directory name contains the PID of the sending process, e.g. {{herodotus[5891]}}. This is not wanted and a regression from 2.8.2, where it was only the application name _without the PID_.


> Syslog appender: syslogtag contains pid of process
> --------------------------------------------------
>
>                 Key: LOG4J2-3225
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3225
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.15.0
>            Reporter: Martin Schröder
>            Priority: Major
>
> We have recently upgrade our projects from 2.8.2 to 2.15.0
> We use the syslog appender with this configuration:
>         <Syslog name="syslog" format="RFC5424" host="localhost" port="514" protocol="UDP"
>                 appName="herodotus" mdcId="mdc" includeMDC="true" facility="LOCAL0" connectTimeoutMillis="100" ignoreExceptions="false">
>             <LoggerFields>
>                 <KeyValuePair key="class" value="%c{1.}"/>
>                 <KeyValuePair key="exception" value="%ex{full}"/>
>             </LoggerFields>
>         </Syslog>
> This is then forwarded to a log host via rsyslog.
> Config on the sender:
> $ModLoad imudp
> $UDPServerRun 514
> #
> if $syslogfacility-text == 'LOCAL0' then {
>         @magpie;RSYSLOG_SyslogProtocol23Format
>         stop
>         }
> Config on the receiver:
> module(load="mmpstrucdata")
> action(type="mmpstrucdata")
> $template java_messages, "/var/log/techonair/%syslogtag%/messages"
> template(name="herodotus" type="string"
>   string="%timereported:::date-rfc3339% %syslogseverity-text:::uppercase% requestId[%$!rfc5424-sd!mdc@18060!requestId%] : %msg% : {%syslogtag%@%hostname%} {Class:%$!rfc5424-sd!mdc@18060!class%} %$!rfc5424-sd!mdc@18060!exception%\n")
> if $syslogtag startswith 'herodotus' then {
>         ?java_messages;herodotus
>         stop
>         }
> Since 2.15.0 the created directory name contains the PID of the sending process, e.g. herodotus[5891]. This is not wanted and a regression from 2.8.2, where it was only the application name _without the PID_.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)