Is there a way to change the timestamp format for /var/log/lightdm/lightdm.log ? I have lines like this

[+391362.52s] DEBUG: Greeter closed communication channel
[+391362.52s] DEBUG: Session pid=19196: Exited with return value 0

And I would like to have something like:

 Aug 21 00:25:01 DEBUG: Greeter closed communication channel
 Aug 21 00:25:01 DEBUG: Session pid=19196: Exited with return value 0


  • The problem I see if I'm not wrong, is that +391362.52s is not a date, but the amount of seconds since you turned your computer on. – schrodigerscatcuriosity Aug 28 '19 at 12:25
  • Yes, it is a relative time. The lightdm process has lightdm.log in its opened files. It seems that it logs directly instead of using syslog. – heroedeleyenda Aug 29 '19 at 14:19

You can get a time format of the type you want by piping the lightdm log-file to systemd journal. Here is an adapted version of a solution taken from a blog post by Daniel Aleksandersen. Another discussion of the same idea can be found here. I tried it with Raspbian and lightdm and it worked like a charm.

Modify the existing lightdm.service file like this, for example:

# /lib/systemd/system/lightdm.service

Description=Light Display Manager

# temporary safety check until all DMs are converted to correct
# display-manager.service symlink handling
ExecStartPre=/bin/sh -c '[ "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/lightdm" ]'

# /etc/systemd/system/lightdm.service.d/pipelog.conf

ExecStartPost=/bin/sh -c 'tail -n 20 "/var/log/lightdm/lightdm.log" | systemd-cat -t "lightdm" '

Then, once you updated the system (for example by rebooting) the lightdm log entries are accessible via the journalctl command. Try journalctl -t lightdm, for instance, and you get the output with both the relative time timestamps and the absolute local time.

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.