0

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

0
1

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.

1

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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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