Bug 136978 - "last" does not print full time and date information -- unusable for parsing output
Summary: "last" does not print full time and date information -- unusable for parsing ...
Status: RESOLVED FIXED
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Final
Hardware: All SuSE Linux 10.0
: P5 - None : Normal
Target Milestone: ---
Assignee: Olaf Dabrunz
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-05 17:51 UTC by Olaf Dabrunz
Modified: 2005-12-05 18:05 UTC (History)
1 user (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
patch implementing option -F (full time) (4.56 KB, patch)
2005-12-05 18:04 UTC, Olaf Dabrunz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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