I used a raspberry pi with Raspbian installed. This board was used for a long experiment, and I want to record all logs. Then on a different PC, what could I do to check the histories?

  • The title suggests you want to record logins, but the question suggests you want to record the logs. Which is it please? – Mark Smith Apr 24 '19 at 8:39
  • Depending on what "long" is and what logs your after, I would just adjust the logrotate conf files to not delete any. This way the older ones are still getting compressed, but you will retain all of them. Then if still need to offload some of them you could have a periodic cron job that moves any *.tar files from /var/log to an external thumb drive( or another computer) – Chad G Apr 24 '19 at 16:41

Your question is a little vague, as to which logs you want, but most are in /var/log and old logs are rolled over (for varying periods - which is configurable) .

Below is a script I use to list apt-get history. You could adapt this to list any logs your are interested in.

This could be run remotely with changed paths; I usually run it over ssh

#Print apt-get history
# 2017-08-06
for logf in $(ls /var/log/apt/history.log.*.gz | sort -rV) ; do zcat $logf | grep -E "Start-Date:|Commandline:" ; done
# Include most recent
grep -E "Start-Date:|Commandline:" /var/log/apt/history.log

dmesg -T lists the kernel log, although this only shows recent entries.

last -x shows system shutdown entries

|improve this answer|||||

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.