Date format in the files written by syslogd

Hi,

Below is what i am seeing in /var/log/messages on ubuntu machine.

2013-01-14T18:29:39.319736+00:00 test01 ldap-mail[2395]:   test1
Jan 14 18:29:39 test01 ldap-mail[2395]:   test2
2013-01-14T18:29:39.320792+00:00 test01 ldap-mail[2395]: test3
Jan 14 18:29:39 test01 ldap-mail[2395]: test4

But on other ubuntu machine i am seeing the log as below

Jan 14 18:30:06 tets02 ldap-mail[19133]:  test01
Jan 14 18:30:06 tets02 ldap-mail[19133]:  test54
Jan 14 18:30:06 tets02 ldap-mail[19133]:  testing testing
Jan 14 18:30:07 tets02 ldap-mail[19133]:  test
Jan 14 18:30:07 tets02 ldap-mail[19133]:  test000

I there a way to correct the date format for test01 server similar to tets02 server?

Check this post.

Thank you for the reply. But in my case i am seeing the date/time format in two different versions as below where the first line is what i want to be consistent. Not sure why am i seeing the second line as different compared to the first one.

Jan 14 18:29:39 test01 ldap-mail[2395]:   test2
2013-01-14T18:29:39.320792+00:00 test01 ldap-mail[2395]: test3

OK,
it appears that the process that writes the lines with the test1 pattern
is using a different date format.
Check the environment of those processes and look for different locale settings.

I didnot understand as i know the what process is writing these logs into a file, but not sure what exactly needs to be updated/changed.

Can you please shed some light?

If different users are used for starting those processes, check the initialization files in their home directories:
.profile, .bash_profile, for example. Look for variable names starting with LC_.

I've checked in user's home directory and i dont see any LC_ refrences in those files and then i have checked the same on the working system still it is the same file without LC_ references.

SO am i missing anything here?

OK, but are you actually using different users for the processes that write test1
and test2? How do you start those processes? A shell script, compiled executable?
Try logging as those users and run:

locale

Then compare the outputs.

Below is the output for locale from the non-working machine

and below is the one from the working machine

Please answer all the questions.

I will start these processes as a root user and with the help of an executable file, So the above output was gathered by logging in as a root user.

Could you post the exact command line that you use to start test1 and test2?

As it is obviously always the same process logging (ldap-mail[2395]) and the logs have the same time stamp, would it be possible there's two syslog daemon processes running? Would make more sense to me, as the interface to syslog is binary afaik, formatting is done in syslogd. On the other hand, what about file locking?

Given the strings test[1-4], I suppose that the OP is testing the process execution of two processes with different locale settings.
You can log to syslog anything you want via the logger utility.

The PID is appended to the process name and is identical for all four entries shown above. You can freely log with logger, but your free style msg will be prepended with a (n internally generated?) time stamp and some system info.
On the other hand, were two syslog processes competing for input, I'd presume the behaviour would be what we see - each instance would get every other msg...

Below is the process for starting test1 and test2

Not sure whether it will make any difference with Date:Manip perl module?

Version on the non-working system is

Version on the working system is

Below is the content from ldap-mail.pl that writes to the logfile

---------- Post updated at 10:52 AM ---------- Previous update was at 10:50 AM ----------

Bottom line i want the log to be displayed as

date/time format

You should post the part that writes to syslog, the above code seems to be writing to another log ...

Actually the log is being written to the below location (i.e)

and the same log will be written into /var/log/messages where i see the alternate lines are kind of misleading (i.e) one line will show the format i would like to and the next following line will show the format as above log.

So I suppose that somewhere in the Perl code you're logging to syslog twice with different date format masks.

Pls grep for log or syslog in the output of ps .