Does anyone know how to configure syslog to use millisecond timestamps in logs on Solaris 10, instead of the default 1 second resolution?

I know syslog-ng is available but I'm hoping I can just set some configuration with the existing syslog process.

Thanks for any help. NickB

link|improve this question
feedback

migrated from stackoverflow.com Dec 22 '09 at 15:11

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 1 down vote accepted

The stock Solaris syslogd does not support millisecond timestamps. You'll need to use an alternative syslogd package (like syslog-ng) if you want this.

link|improve this answer
feedback

I don't think so. If you're trying to debug some timing issue, then syslog may not be the right way to do that. However, if you're writing your own code, then you could include the time in the message portion of a syslog(3C) call (or from the shell, logger(1)). The log entry would still be on the whole second, but the message would contain the fractional part (although precision probably wouldn't be great if you're doing it from a shell script).

Maybe something along the lines of this:

// use gettimeofday(3C) to get microseconds (availability is hardware dependent)
syslog(LOG_INFO|LOG_LOCAL0, "Program foo timestamp: %d", microseconds);
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.