ranwhen icon indicating copy to clipboard operation
ranwhen copied to clipboard

Access to oldest log (fix proposed) - Ubuntu 16.04

Open gustawdaniel opened this issue 9 years ago • 3 comments

Hi

Your script is AWESOME! But today I was confused by short time of history displayed in program. I fixed it. Please look at the screen.

  • On the right side is version that use oldest logs - with my modification.
  • On the left side is version from this repository - original version.

rawhen_fix

Command wc /var/log/wtpm* calculates lines of files with temporal log this month wtmp and oldest wtmp.1.

My fixture is simple and changes line:

163 | command = "last -R -F reboot"

to

163 | command = "last -R -F reboot -f /var/log/wtmp.1"

In your docs I see that by "last -R -F reboot" you have access to 83 days of history. But It was 4 years ago. Probably somethings was changed in logging mechanisms of Ubuntu. My fix allow to get only 28 days.

It is possible, that best solution is concatenate results of these commands. But I don't know rules that assign content of these logs. I asked about this on askubuntu.com

Sources:

question about old logs askubuntu.com my extended question on askubuntu.com

gustawdaniel avatar Dec 02 '16 15:12 gustawdaniel

Not sure if that's actually a fix. If wtmp log rotation works as I expect, /var/log/wtmp.1 would actually be missing the most recent login entries. Please correct me if I've misunderstood.

p-e-w avatar Dec 11 '16 05:12 p-e-w

I would like to help solve this problem, but my skill is to low. My question on askubuntu remain without answer. I suspect that that wtpm have config that allow to prevent deleting logs. Maybe simpler, but less correct approach is add cron task that save interesting data to other location.

gustawdaniel avatar Dec 21 '16 17:12 gustawdaniel

I obtained answer.

https://askubuntu.com/questions/856199/access-to-logs-of-startup-and-shut-down

So I propose to write about log mechanism of rotation of logs introduced in in ubuntu 16 and close this issue :)

gustawdaniel avatar Jun 15 '17 14:06 gustawdaniel