KSH logging of users activity



Folks,

I have a requirement of logging users activity (the commands executed
by them) to a LOGHOST. To some extent, I got the solution to it and it can be
found at
http://blogs.sun.com/chrisg/entry/logging_commands_in_korn_shell#comments
..... Thanks to Chris for this solution. :-)

------------------------From
above link... (Chris's web blog)------------------------------
Type this into
your shell and you can capture the command, it's return code and the current
working directory.
function dlog
{
typeset -i stat=$?
typeset
x
x=$(fc -ln -0)
logger -p local3.debug -t "ksh $LOGNAME $$"
Status $stat PWD $PWD \'${x# }\'
}
trap dlog DEBUG

(note that there is
a tab after the # in ${x# })
-----------------------------------------------------------------------------
---------------------

I am able to configure the logging to a central system
and it is working to almost 90% cases. :-) Now the catch is, if I am using two
or more pipes in a command, then it is not logging and exiting/pushing me out
from the system and the session terminates. For example, if I run the
following command:

# ls -l | grep mohan -----> It works and
gets recorded in the logs.
# ls -l | grep mohan | grep txt -----> It doesn't
work and terminates the session.

When I disabled the logging, all commands
are working without any problem. Can anyone let me know what correction can be
done in the function so that it can accept more pipes.

OR -- Any other
solution which can do the equivalent (KSH logging).

Cheers,
Mohan
_____________________________________________________________________________
_______
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.
Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
_______________________________________________
sunmanagers mailing list
sunmanagers@xxxxxxxxxxxxxxx
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



Relevant Pages

  • Error messages after logging out of window
    ... I get error messages most of time after logging out of window. ... -bash: Unable: command not found ... $ waiting for X server to shut down ...
    (RedHat)
  • Re: Questions on 800 series ADSL router
    ... into enable mode ... enable logging on your terminal emulator ... I just tried this and the 'run sh' command is not recognized. ...
    (comp.dcom.sys.cisco)
  • Re: Pattern for foo tool <-> API <-> shell|GUI
    ... corresponding command and provide the verified options as parameters. ... for critical errors) and logging features (based on logging from Python ... Provide these parameters for a particular call to command API ... They are all verified from the command itself, although a client could do ...
    (comp.lang.python)
  • Re: Exchange/ISA Questions
    ... when you turn the logging on you will see the location of the logfiles. ... > The telnet session is clean. ... >> another form of logging in the properties for the server itself. ... It should have a command ...
    (microsoft.public.backoffice.smallbiz2000)
  • Re: Remembered Credentials...
    ... Try logging off and then logging back on or using the net use command to see ... How can I flush these remembered credentials ...
    (microsoft.public.win2000.security)