You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Neeraj (Jira)" <ji...@apache.org> on 2019/09/24 08:02:00 UTC

[jira] [Comment Edited] (LOG4J2-2567) syslog appender, tcp causes 'invalid frame header', connection dropped with syslog-ng server

    [ https://issues.apache.org/jira/browse/LOG4J2-2567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16936528#comment-16936528 ] 

Neeraj edited comment on LOG4J2-2567 at 9/24/19 8:01 AM:
---------------------------------------------------------

One workaround:

use "{color:#6a8759}useTlsMessageFormat{color}" = true, this has octet count frame.

You will need to pass layout information yourself. Programmatically e.g

AppenderComponentBuilder appenderBuilder = builder.newAppender({color:#6a8759}"loggername"{color}{color:#cc7832}, {color}{color:#6a8759}"Syslog"{color}){color:#808080}
{color} .addAttribute({color:#6a8759}"name"{color}{color:#cc7832}, {color}{color:#6a8759}"loggername"{color})
 .addAttribute({color:#6a8759}"format"{color}{color:#cc7832},{color}{color:#6a8759}"RFC5424"{color})
 .addAttribute({color:#6a8759}"host"{color}{color:#cc7832}, {color}{color:#6a8759}"localhost"{color})
 .addAttribute({color:#6a8759}"port"{color}{color:#cc7832}, {color}{color:#6a8759}"6666"{color})
 .addAttribute({color:#6a8759}"protocol"{color}{color:#cc7832}, {color}{color:#6a8759}"TCP"{color})

.addComponent(builder.newLayout({color:#6a8759}"Rfc5424Layout"{color})
 .addAttribute({color:#6a8759}"useTlsMessageFormat"{color}{color:#cc7832}, {color}{color:#6a8759}"true"{color})
 .addAttribute({color:#6a8759}"id"{color}{color:#cc7832},{color}{color:#6a8759}"App"{color})
 .addAttribute({color:#6a8759}"mdcId"{color}{color:#cc7832}, {color}{color:#6a8759}"mdc"{color})
 .addAttribute({color:#6a8759}"includeMDC"{color}{color:#cc7832},{color}{color:#6a8759}"true"{color})
 .addAttribute({color:#6a8759}"facility"{color}{color:#cc7832},{color}{color:#6a8759}"LOCAL0"{color})
 .addAttribute({color:#6a8759}"enterpriseNumber"{color}{color:#cc7832},{color}{color:#6a8759}"18060"{color})
 .addAttribute({color:#6a8759}"useTlsMessageFormat"{color}{color:#cc7832}, {color}{color:#6a8759}"true"{color})
 )


was (Author: hellbat):
One workaround: 

use "{color:#6a8759}useTlsMessageFormat{color}" = true, this has octet count frame.

You will need to pass layout information yourself. Programmatically e.g

.addComponent(builder.newLayout({color:#6a8759}"Rfc5424Layout"{color})
 .addAttribute({color:#6a8759}"useTlsMessageFormat"{color}{color:#cc7832}, {color}{color:#6a8759}"true"{color})
 .addAttribute({color:#6a8759}"id"{color}{color:#cc7832},{color}{color:#6a8759}"App"{color})
 .addAttribute({color:#6a8759}"mdcId"{color}{color:#cc7832}, {color}{color:#6a8759}"mdc"{color})
 .addAttribute({color:#6a8759}"includeMDC"{color}{color:#cc7832},{color}{color:#6a8759}"true"{color})
 .addAttribute({color:#6a8759}"facility"{color}{color:#cc7832},{color}{color:#6a8759}"LOCAL0"{color})
 .addAttribute({color:#6a8759}"enterpriseNumber"{color}{color:#cc7832},{color}{color:#6a8759}"18060"{color})
 .addAttribute({color:#6a8759}"useTlsMessageFormat"{color}{color:#cc7832}, {color}{color:#6a8759}"true"{color})
)

> syslog appender, tcp causes 'invalid frame header', connection dropped with syslog-ng server
> --------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-2567
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2567
>             Project: Log4j 2
>          Issue Type: Question
>          Components: Appenders
>    Affects Versions: 2.11.2
>            Reporter: a b
>            Priority: Major
>
> Hi.
> {code:xml}
> <Appenders>
>  <Syslog appName="test" connectTimeoutMillis="3000" host="127.0.0.1" immediateFail="true" mdcId="syslog-mdcid" name="syslog" newLine="true" port="7601" protocol="TCP" reconnectionDelayMillis="3000"/>
> </Appenders>{code}
>  
> using syslog-ng (3.19.1), here's what the server prints-out:
> {noformat}
> [2019-03-21T11:34:26.046972] Syslog connection accepted; fd='17', client='AF_INET(172.17.0.1:39432)', local='AF_INET(0.0.0.0:601)'
> [2019-03-21T11:34:26.066218] Invalid frame header; header=''
> [2019-03-21T11:34:26.066339] Syslog connection closed; fd='17', client='AF_INET(172.17.0.1:39432)', local='AF_INET(0.0.0.0:601)'
> {noformat}
> Using
> {noformat}
> logger -n 127.0.0.1 -P 7601 -T --octet-count test{noformat}
> works fine.
> How can I configure log4j2 to send a syslog message, over non-tls TCP, to syslog-ng correctly?
> Thanks!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)