Bug 136978

Summary: "last" does not print full time and date information -- unusable for parsing output
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Olaf Dabrunz <odabrunz>
Component: BasesystemAssignee: Olaf Dabrunz <odabrunz>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: werner
Version: Final   
Target Milestone: ---   
Hardware: All   
OS: SuSE Linux 10.0   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: patch implementing option -F (full time)

Description Olaf Dabrunz 2005-12-05 17:51:29 UTC
The output of the "last" command does not include the year for in the login
time and the time for other events (reboot times). Logout times only show the
time field (presumably because formerly people would log out of their terminal
sessions on the same day when they logged in).

Example:
od@blackberry:~> last
[...]
od       pts/27                        Tue Nov 29 11:32    gone - no logout 
od       pts/22                        Fri Nov 25 14:10 - 19:04 (1+04:54)
od       pts/18                        Fri Nov 25 14:10   still logged in
od       :0           console          Thu Nov 24 22:57   still logged in   
reboot   system boot  2.6.13-15-ppc64  Thu Nov 24 22:56         (10+19:32)  
od       pts/34                        Thu Nov 24 20:11 - crash  (02:44)    
root     pts/0        goro.suse.de     Tue Sep 20 14:34 - down   (00:07)    
[...]


AFAICT, the main advantages of this output format are compactness (it fits in
most terminals) and that to some extend it is more readable (albeit inaccurate
for the logout times).

To make the output of "last" more accurate to the user and especially for
parsing it from scripts, a different output format should be selectable
that displays full time and date information.

The attached patch introduces the new flag "-F" (for "full time"). The flag
changes the output to this:

od@blackberry:~> last -F
[...]
od       pts/27                        Tue Nov 29 11:32:28 2005   gone - no logout                     
od       pts/22                        Fri Nov 25 14:10:06 2005 - Sat Nov 26 19:04:32 2005 (1+04:54)
od       pts/18                        Fri Nov 25 14:10:06 2005   still logged in
od       :0           console          Thu Nov 24 22:57:11 2005   still logged in                      
reboot   system boot  2.6.13-15-ppc64  Thu Nov 24 22:56:33 2005                            (10+19:32)  
od       pts/34                        Thu Nov 24 20:11:45 2005 - crash                     (02:44)    
root     pts/0        goro.suse.de     Tue Sep 20 14:34:17 2005 - down                      (00:07)    
[...]


Other options like -a, -d and -i work with option -F:

od@blackberry:~> last -F -a -d
[...]
od       pts/27       Mon Nov 28 17:54:14 2005 - Mon Nov 28 23:57:24 2005  (06:03)     priv-od.home.suse.de
od       pts/22       Fri Nov 25 14:10:06 2005 - Sat Nov 26 19:04:32 2005 (1+04:54)    0.0.0.0
od       pts/18       Fri Nov 25 14:10:06 2005   still logged in                       0.0.0.0
[...]
Comment 1 Olaf Dabrunz 2005-12-05 18:04:27 UTC
Created attachment 59859 [details]
patch implementing option -F (full time)
Comment 2 Olaf Dabrunz 2005-12-05 18:05:31 UTC
submitting to STABLE