python - Finding login times in Linux -


i trying figure out times of logins systems (basically systems boot).

i making use of last unix command. however, not let me pull more number of entries. assume log file pulls, /var/log/wtmp, gets overwritten after size.

i see have wtmp.1 file also, using -f parameter can go month further logs using parameter. wondering if logs further archived somewhere.

so, question is: there way older entries.

the following last call making:

last -n 10000|grep "system" 

here last few lines of output

reboot   system boot  3.5.0-36-generic sun jul  7 07:07 - 22:08  (15:01)     reboot   system boot  3.5.0-36-generic sat jul  6 23:23 - 23:23  (00:00)     reboot   system boot  3.5.0-34-generic sat jul  6 09:40 - 23:22  (13:42)     reboot   system boot  3.5.0-34-generic sat jul  6 09:38 - 09:39  (00:00)     reboot   system boot  3.5.0-34-generic sat jul  6 06:40 - 09:39  (02:58)     reboot   system boot  3.5.0-34-generic sat jul  6 06:15 - 06:17  (00:02)     reboot   system boot  3.5.0-34-generic sat jul  6 06:13 - 06:17  (00:03)     reboot   system boot  3.5.0-34-generic fri jul  5 19:30 - 22:34  (03:03)  

i not able logs further in time.

  1. is correct approach?
  2. how see older logs? instance if pass -n 10000 or -n 1000000, same output.

eventually write quick python script parse o/p subprocess module.

edit : of answers below correct. unfortunately accept 1 answer. logs once gone gone!

you don't type of unix / linux running on ubuntu hosts works last boot times

for f in /var/log/wtmp*; last -f $f reboot;done 

all find wtmp files in /var/log , filter out reboot user


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -