0

My wife and I have been gaming through steam on my Ubuntu based Linux laptop. I want to know which of us have played more this month. We play different games, so adding up play times by game run time is possible. The problem is I don't know where or if there is even a log that would have this information. The syslog only keeps a days worth of data, and steam only has total play times for each game. Does anyone know of a log or way to find this info?

2
  • "syslog only keeps a days worth of data" - not so. Look at sudo journalctl -list-boots, and sudo journalctl -b 0.
    – waltinator
    Commented Jul 2 at 15:44
  • Do you and your wife login as different users, and logoff when done? Then "process accounting" (man pacct, and be sure logrotate is working) could tell you apart. Process Accounting can use a lot of disk space, so it's OFF by default.
    – waltinator
    Commented Jul 2 at 15:50

1 Answer 1

0

Since according to the original question, the syslog would satisfy the need except that syslog only has about a day's worth of data.

Somehow, be it perl, sed/awk, or something else, the recent material can be gleened from syslog. What's also needed is to routinely gather this information from syslog, appending it to what has already been gleened. It's also important to insure you don't gleen the same entries more than once thus .

  1. the gleen needs to be done on a schedule
  2. syslog needs to be 'rolled over'.

Scheduling would be achieved by running the gleener and syslog roll-over as a shell invoked via crontab. The syslog roll-over is going to have to be done using root thus the cron-job will need to run from root's crontab (as in sudo crontab -e).

I use a shell to regularly roll over my syslog. That code, run as

sudo logswitch.sh

is as follows:

#!/bin/bash
#  logswitch.sh starts a new syslog
#  moving the previous three versions down
#
rm /var/log/syslog.4.gz
mv /var/log/syslog.3.gz /var/log/syslog.4.gz
mv /var/log/syslog.2.gz /var/log/syslog.3.gz
tar -czf /var/log/syslog.2.gz /var/log/syslog.1
chown syslog /var/log/syslog.2.gz
chgrp adm /var/log/syslog.2.gz
rm /var/log/syslog.1
cat /var/log/syslog > /var/log/syslog.1
chown syslog /var/log/syslog.1
chgrp adm /var/log/syslog.1
cat /dev/null >/var/log/syslog
chown syslog /var/log/syslog
chgrp adm /var/log/syslog
service rsyslog restart  

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .