You can specify login or logout events to monitor by setting the
watch variable. Normally, this is done by specifying a list of
% watch=( pfalstad subbarao sukthnkr egsirer )
log command reports all people logged in that you are
% log pfalstad has logged on p0 from mickey. pfalstad has logged on p5 from mickey. % ... subbarao has logged on p8 from phoenix. % ... subbarao has logged off p8 from phoenix. % ... sukthnkr has logged on p8 from dew. % ... sukthnkr has logged off p8 from dew.
If you specify hostnames with an @ prepended, the shell will watch for all users logging in from the specified host.
% watch=( @mickey @phoenix ) % log djthongs has logged on q2 from phoenix. pfalstad has logged on p0 from mickey. pfalstad has logged on p5 from mickey.
If you give a tty name with a % prepended, the shell will watch for all users logging in on that tty.
% watch=( %ttyp0 %console ) % log root has logged on console from . pfalstad has logged on p0 from mickey.
The format of the reports may also be changed.
% watch=( pfalstad gettes eps djthongs jcorr bdavis ) % log jcorr has logged on tf from 126.96.36.199:0. jcorr has logged on r0 from 188.8.131.52:0. gettes has logged on p4 from yo:0.0. djthongs has logged on pe from grumpy:0.0. djthongs has logged on q2 from phoenix. bdavis has logged on qd from BRUNO. eps has logged on p3 from csx30:0.0. pfalstad has logged on p0 from mickey. pfalstad has logged on p5 from mickey. % WATCHFMT='%n on tty%l from %M' % log jcorr on ttytf from 184.108.40.206:0. jcorr on ttyr0 from 220.127.116.11:0. gettes on ttyp4 from yo:0.0 djthongs on ttype from grumpy:0.0 djthongs on ttyq2 from phoenix.Princeto bdavis on ttyqd from BRUNOpl.gov eps on ttyp3 from csx30:0.0 pfalstad on ttyp0 from mickey.Princeton pfalstad on ttyp5 from mickey.Princeton % WATCHFMT='%n fm %m' % log jcorr fm 18.104.22.168:0 jcorr fm 22.214.171.124:0 gettes fm yo:0.0 djthongs fm grumpy:0.0 djthongs fm phoenix bdavis fm BRUNO eps fm csx30:0.0 pfalstad fm mickey pfalstad fm mickey % WATCHFMT='%n %a at %t %w.' % log jcorr logged on at 3:15pm Mon 20. jcorr logged on at 3:16pm Wed 22. gettes logged on at 6:54pm Wed 22. djthongs logged on at 7:19am Thu 23. djthongs logged on at 7:20am Thu 23. bdavis logged on at 12:40pm Thu 23. eps logged on at 4:19pm Thu 23. pfalstad logged on at 3:39am Fri 24. pfalstad logged on at 3:42am Fri 24.
If you have a `.friends' file in your home directory, a convenient way to make zsh watch for all your friends is to do this:
% watch=( $(< ~/.friends) ) % echo $watch subbarao maruchck root sukthnkr ...
watch is set to
all, then all users logging in or out
will be reported.