简体   繁体   中英

Access to timestamp in C - syslog ng

I'm working on a C project, with client/server syslog communication with a Rpi. I have been asked to use syslog ng and I'd like to access to timestamp.

From what I found here :

Where the timestamp comes from depends on the type of log data you're sending through.

Plus :

If your data is forwarded by a syslog service, there is a timestamp embedded in the header that we can pull out and use.

So it's possible to pull out the timestamp. But how ?

If you use syslog-ng, it handles two different time stamps:

  • the one, when the message was actually received
  • the one included in the syslog message

These are accessible through macros. You can read more about it at https://www.balabit.com/sites/default/files/documents/syslog-ng-ose-3.7-guides/en/syslog-ng-ose-v3.7-guide-admin/html-single/index.html#reference-macros

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM