Sun's 'last' command

Sun's 'last' command

Post by Sean Gil » Fri, 28 May 1999 04:00:00



How do I get the 'last' command to not truncate the host (3rd) field.
Sometimes DNS names are too long and don't fit in that field.  Do I have to
go and edit a .h file somewhere to get that field to display on the screen
properly?  Will a perl script help me here?

Sean Gill

 
 
 

Sun's 'last' command

Post by Ken Pizzi » Sat, 29 May 1999 04:00:00



>How do I get the 'last' command to not truncate the host (3rd) field.
>Sometimes DNS names are too long and don't fit in that field.  Do I have to
>go and edit a .h file somewhere to get that field to display on the screen
>properly?  Will a perl script help me here?

When you log in a file with a fixed-field format (wtmp) is updated;
this file is consulted by "last".  In order to record more information
you will need to update the utmp.h header file and recompile all
programs on your system which update/access the wtmp file (including,
but not limited to: init, login, who, w, last, xterm).

                --Ken Pizzini

 
 
 

Sun's 'last' command

Post by Mark Mentova » Sat, 29 May 1999 04:00:00


Ken Pizzini wrote in comp.sys.sun.admin:


>>How do I get the 'last' command to not truncate the host (3rd) field.
>>Sometimes DNS names are too long and don't fit in that field.  Do I have to
>>go and edit a .h file somewhere to get that field to display on the screen
>>properly?  Will a perl script help me here?

>When you log in a file with a fixed-field format (wtmp) is updated;
>this file is consulted by "last".  In order to record more information
>you will need to update the utmp.h header file and recompile all
>programs on your system which update/access the wtmp file (including,
>but not limited to: init, login, who, w, last, xterm).

This is true, but if you're dealing with an instance where the ut_host
field in the wtmp/wtmpx file is larger than what last is displaying
(which is the case on Solaris), then all you need to do is modify last.

On Solaris, (utmpx).ut_host is a 257-character field (256 plus a null).
That's large enough to store just about any hostname in its entirety,
all that's needed is a program that can read it.  I don't know if
anybody's done this with last for Solaris, though.

-MM

 
 
 

Sun's 'last' command

Post by Craig Johnst » Sun, 30 May 1999 04:00:00





>>How do I get the 'last' command to not truncate the host (3rd) field.
>>Sometimes DNS names are too long and don't fit in that field.  Do I have to
>>go and edit a .h file somewhere to get that field to display on the screen
>>properly?  Will a perl script help me here?

>When you log in a file with a fixed-field format (wtmp) is updated;

Huh?  Does anything really use wtmp rather than wtmpx anymore?

At least in recent versions of Solaris, the info you want is in wtmpx.
Looking at /usr/include/utmpx.h on a 2.6 system, I see that ut_host has
space for 256 characters and a terminating null.

Write your own last command, using the utmpx structure in utmpx.h
as a guide.  The wtmpx file is just a bunch of these structures.
You can then print as many characters of the hostname as your heart
desires.  

As far as I know there is no way to make Sun's 'last' print more
characters, and you will have a hard time recompiling Sun's binaries
without an expensive source license.

Quote:>this file is consulted by "last".  In order to record more information
>you will need to update the utmp.h header file and recompile all
>programs on your system which update/access the wtmp file (including,
>but not limited to: init, login, who, w, last, xterm).

>            --Ken Pizzini

--
Craig Johnston      

 
 
 

1. Help: problems with 'w', 'who' and 'last'

Recently I upgraded our machines from RedHat5.1 to
RedHat5.2. Everything is OK, but now three machines behave
strange with w, who and last. last returns trash:



still logged in
p1       21.pv.reshsg                  Wed Dec 31 16:00 -
16:00  (00:00)
dialin33 p1                            Wed Dec 31 16:00 -
16:00  (00:00)
...

w and who give only the top line and empty body:

 10:03am  up 7 days, 19:52,  0 users,  load average: 0.00,
0.00, 0.00

PCPU  WHAT

I copied these executables from machines where they behave
well along with /var/log/wtmp file and for a while this
fixed the problem, but after a couple of minutes the problem
appeared again. It seems that there is a reference data set
that is updated periodically ... I really have no idea what
is going on.

Is there an easier way to fix this problem than reinstalling
the OS?

Thanks. Ted

2. StarOffice 5.1

3. 'last' command doesn't show complete login times

4. Quake3 on Linux - Spectacular!

5. The 'last' command doesn't record users logout

6. prob: X and virtual consoles

7. Piping results of a 'find' command to a 'mv' command...

8. FA: LINUX PC box...

9. How to hide from 'who', 'finger', 'ps' commands?

10. Help with 'user', 'w', 'who' commands

11. Port of Sun's 'bar' command?

12. Where's Finger's 'last login' info stored?

13. the 'last' command