You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sameer Babu K K <sa...@yahoo.com.INVALID> on 2015/04/21 23:55:35 UTC

Syslog data format incorrect parsing of structured data

According to RFC 5424 syslog structured data can be like the below examples:


   All examples in this section show only the structured data part of
   the message.  Examples should be considered to be on one line.  They
   are wrapped on multiple lines in this document for readability
   purposes.  A description is given after each example.

   Example 1 - Valid

           [exampleSDID@32473 iut="3" eventSource="Application"
           eventID="1011"]

   This example is a structured data element with a non-IANA controlled
   SD-ID of type "exampleSDID@32473", which has three parameters.

   Example 2 - Valid

           [exampleSDID@32473 iut="3" eventSource="Application"
           eventID="1011"][examplePriority@32473 class="high"]




But the syslog data format (org.apache.camel.component.syslog.SyslogConverter) just considers the value till next space as the structured message.


            StringBuilder msgId = new StringBuilder();
            while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
                msgId.append(charFound);
            }
            rfc5424SyslogMessage.setMsgId(msgId.toString());

            StringBuilder structuredData = new StringBuilder();
            while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
                structuredData.append(charFound);
            }
            rfc5424SyslogMessage.setStructuredData(structuredData.toString());

This seems to be a bug to me. Is there a fix or latest version available for this parsing?

Best Regards,Sameer
 

Re: Syslog data format incorrect parsing of structured data

Posted by Willem Jiang <wi...@gmail.com>.
I just create a JIRA[1] and the patch is on the way.

[1]https://issues.apache.org/jira/browse/CAMEL-8687

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 22, 2015 at 5:57:38 AM, Sameer Babu K K (sameerbkk@yahoo.com.invalid) wrote:
> According to RFC 5424 syslog structured data can be like the below examples:
>  
>  
> All examples in this section show only the structured data part of
> the message. Examples should be considered to be on one line. They
> are wrapped on multiple lines in this document for readability
> purposes. A description is given after each example.
>  
> Example 1 - Valid
>  
> [exampleSDID@32473 iut="3" eventSource="Application"
> eventID="1011"]
>  
> This example is a structured data element with a non-IANA controlled
> SD-ID of type "exampleSDID@32473", which has three parameters.
>  
> Example 2 - Valid
>  
> [exampleSDID@32473 iut="3" eventSource="Application"
> eventID="1011"][examplePriority@32473 class="high"]
>  
>  
>  
>  
> But the syslog data format (org.apache.camel.component.syslog.SyslogConverter)  
> just considers the value till next space as the structured message.
>  
>  
> StringBuilder msgId = new StringBuilder();
> while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
> msgId.append(charFound);
> }
> rfc5424SyslogMessage.setMsgId(msgId.toString());
>  
> StringBuilder structuredData = new StringBuilder();
> while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
> structuredData.append(charFound);
> }
> rfc5424SyslogMessage.setStructuredData(structuredData.toString());
>  
> This seems to be a bug to me. Is there a fix or latest version available for this parsing?  
>  
> Best Regards,Sameer
>  
>  


Re: Syslog data format incorrect parsing of structured data

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You are welcome to log a JIRA and work on a patch to fix this
http://camel.apache.org/support

On Tue, Apr 21, 2015 at 11:55 PM, Sameer Babu K K
<sa...@yahoo.com.invalid> wrote:
> According to RFC 5424 syslog structured data can be like the below examples:
>
>
>    All examples in this section show only the structured data part of
>    the message.  Examples should be considered to be on one line.  They
>    are wrapped on multiple lines in this document for readability
>    purposes.  A description is given after each example.
>
>    Example 1 - Valid
>
>            [exampleSDID@32473 iut="3" eventSource="Application"
>            eventID="1011"]
>
>    This example is a structured data element with a non-IANA controlled
>    SD-ID of type "exampleSDID@32473", which has three parameters.
>
>    Example 2 - Valid
>
>            [exampleSDID@32473 iut="3" eventSource="Application"
>            eventID="1011"][examplePriority@32473 class="high"]
>
>
>
>
> But the syslog data format (org.apache.camel.component.syslog.SyslogConverter) just considers the value till next space as the structured message.
>
>
>             StringBuilder msgId = new StringBuilder();
>             while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
>                 msgId.append(charFound);
>             }
>             rfc5424SyslogMessage.setMsgId(msgId.toString());
>
>             StringBuilder structuredData = new StringBuilder();
>             while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
>                 structuredData.append(charFound);
>             }
>             rfc5424SyslogMessage.setStructuredData(structuredData.toString());
>
> This seems to be a bug to me. Is there a fix or latest version available for this parsing?
>
> Best Regards,Sameer
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/