Search code examples
clinuxsyslogrsyslog

write custom timestamp into syslog using syslog.h


my program get events from remote systems, every event contains an timestamp. I want to log this events to syslog using the event timestamp instead of systemtime.

Is there any way to send a custom header to syslog deamon ?

I'm using rsyslog on debian

EDIT:

The "events" are generated by some "bare-metal" devices. My application is a gateway between a realtime-ethernet (EthernetPOWERLINK) and a normal network.

I want to save them in micro-second precision, because its important to know in wich sequence they are occoured.

So i need the exact timestamp created by the bare-metal devices. I'like to put this events into syslog. I did not found any lib (except syslog.h) to write into syslog).

I really need to build the packages myself and send them to rsyslog deamon ?


Solution

  • Ok've solved this, by enabling networking support (TCP) and micro seconds timer in rsyslog configuration.

    Accroding to RFC 5424 my application build raw syslog messages and sends them via TCP (port 514) to the deamon. Thanks to Nominal Animal, but i've no choice...