LightDM logging of login and logout attempts

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
miffy
Level 1
Level 1
Posts: 4
Joined: Fri Nov 13, 2015 10:28 am

LightDM logging of login and logout attempts

Post by miffy »

Hi everyone!

Since my computer st the office is always on nowadays, i can't use reboots and shutdowns as indicators of when i started and ended work as i did before.
So i thought i use login / logout events instead - but they seem not to be logged/protocolled anywhere.

I can't see anything of that kind in journalctl, /var/log/lightdm/ does not change in any way when i log out and in again and those "lightdm.log" files don't seem to have such information - or i can't identify it.

(The display manager seems to be LightDM with slick-greeter since it is an (in that regard) unchanged Mint 19.3 Cinnamon.)

Has anyone an idea how such logging can be accomplished?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
AndyMH
Level 21
Level 21
Posts: 13710
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: LightDM logging of login and logout attempts

Post by AndyMH »

Write a simple bash script with a desktop launcher to log when you started and again when you finish.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: LightDM logging of login and logout attempts

Post by smurphos »

Hi,

This can be informative

Code: Select all

journalctl -b | grep -E 'Started Session|Stopping Session'
Example

Code: Select all

steve@steve-Inspiron-5580:~$ journalctl -b | grep -E 'Started Session|Stopping Session'
Jul 02 07:05:03 steve-Inspiron-5580 systemd[1]: Started Session c1 of user lightdm.
Jul 02 07:05:10 steve-Inspiron-5580 systemd[1]: Stopping Session c1 of user lightdm.
Jul 02 07:05:10 steve-Inspiron-5580 systemd[1]: Started Session c2 of user steve.
Jul 02 07:11:51 steve-Inspiron-5580 systemd[1]: Stopping Session c2 of user steve.
Jul 02 07:11:52 steve-Inspiron-5580 systemd[1]: Started Session c3 of user lightdm.
Jul 02 07:12:00 steve-Inspiron-5580 systemd[1]: Stopping Session c3 of user lightdm.
Jul 02 07:12:00 steve-Inspiron-5580 systemd[1]: Started Session c4 of user steve.
Interpretation - Booted and logged in at 7:05. Logged out at 7:11, logged back in at 7:12.

Note on this system in /etc/systemd/logind.conf I've set KillUserProcesses=yes

The default is no. On systems with the default, user sessions aren't stopped on logout so you'd get output like this which isn't quite as clearcut.

Code: Select all

steve@steve-Inspiron-5580:~$ journalctl -b -1 | grep -E 'Started Session|Stopping Session'
Jul 02 05:52:02 steve-Inspiron-5580 systemd[1]: Started Session c1 of user lightdm.
Jul 02 05:52:13 steve-Inspiron-5580 systemd[1]: Stopping Session c1 of user lightdm.
Jul 02 05:52:13 steve-Inspiron-5580 systemd[1]: Started Session c2 of user steve.
Jul 02 06:57:45 steve-Inspiron-5580 systemd[1]: Started Session c3 of user lightdm.
Jul 02 06:57:51 steve-Inspiron-5580 systemd[1]: Stopping Session c3 of user lightdm.
Jul 02 06:57:51 steve-Inspiron-5580 systemd[1]: Started Session c4 of user steve.
Jul 02 07:04:40 steve-Inspiron-5580 systemd[1]: Stopping Session c2 of user steve.
Jul 02 07:04:40 steve-Inspiron-5580 systemd[1]: Stopping Session c4 of user steve.
Interpretation - Booted and logged in at 5:52, logged out at 6:57 (i.e if lightdm has started then steve has either logged out or the switch user function has been invoked), logged back in at 6:57, rebooted at 7:04
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
miffy
Level 1
Level 1
Posts: 4
Joined: Fri Nov 13, 2015 10:28 am

Re: LightDM logging of login and logout attempts

Post by miffy »

OMG i'm so f***** lazy. BIG Sorry.

... i was googling how to solve a problem - found this thread and thought: Interesting - this guy has *the exact same problem*. (isn't there a facepalm Smiley anywhere?)

However - that unfortunately doesn't work:

Code: Select all

journalctl --since 2021-03-24 -b  | grep -E 'Started Session|Stopping Session'
Mär 30 18:19:00 oakland systemd[1]: Started Session 41239 of user rydell.
Mär 31 17:51:20 oakland systemd[1]: Started Session 42718 of user rydell.
<logging out>
<logging in>
journalctl --since 2021-03-24 -b  | grep -E 'Started Session|Stopping Session'
Mär 30 18:19:00 oakland systemd[1]: Started Session 41239 of user rydell.
Mär 31 17:51:20 oakland systemd[1]: Started Session 42718 of user rydell.
-> nothing changed.

I am not closing the session - i just log lock the Screen (Ctrl-Alt-l). Maybeeeee - that's not called "logging out" on second thought :-) - but that's what i do.
I guess then there also isn't a point in writhing any scripts then?
Locked

Return to “Cinnamon”