The default C syslog() function predates RFC-5424, so it doesn't give you a way
to pass this. You would either need to write a replacement, or use something
like liblogging which is designed to give you more advanced options. I believe
it does rfc5424, and it also will do json structured logs.
David Lang
On Fri, 6 May 2016, Zhou, Tao wrote:
Thanks David for youy prompt reply.
Did you mean rfc5424 ? if so, the message is deifned in BNF:
SYSLOG-MSG = HEADER SP STRUCTURED-DATA [SP MSG]
HEADER = PRI VERSION SP TIMESTAMP SP HOSTNAME SP APP-NAME SP PROCID SP
MSGID
An originator, which is the caller of syslog() function in our case, can
specify MSGID ?
Looks syslog() C function only can specify the facility/priority and the
message body. Is there any way to generate the header with MSGID specified by
the function callers ?
Currently we are implementing this in a filter, where a keyword is scanned in
the message body to identify the log type.
Regards,
Tao.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of David Lang
Sent: Thursday, May 05, 2016 8:54 PM
To: rsyslog-users
Subject: Re: [rsyslog] how to set property msgid value by rsyslog API ?
On Thu, 5 May 2016, Zhou, Tao wrote:
Hi there,
We are evaluating the logging system variants for our embedded low end Linux
application. One of our requirements is to identify the log type when the log
message is generated at the first place.
msgid is defined as property in rsyslog. How do I set msgid when I generate a
log ?
I searched the rsyslog documents and what I found was how to use property, i.e.
msgid, hostname, etc in filter and template. Nothing about how to generate them
by users API.
They are set by passing in a message using the RFC5324 format.
Or, you can parse the message that you have received and then create a custom
template to output the message with the extracted value in the msgid field.
David Lang
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards NOTE WELL: This is
a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our
control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE
THAT.
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE
THAT.