Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

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

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

2 Answers 2

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.

share|improve this answer

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);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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