AIX: extended logging

If you wanna have all history logged there are probably many ways and methods:

This one is one way we do the logging:

 

/etc/profile

. /sbin/log.sh

/sbin/log.sh

function log
{
        if [[ $- = *i* ]]; then
                if [[ $LOGNAME = !(nagios|*adm) ]] ; then
                        typeset TTY=`who am i | awk '{print $2}'`
                        if [[ $TTY = @(pts*) ]] ; then
                                typeset -i STAT=$?
                                typeset X=$(fc -t -n -0)
                                logger -p daemon.info -t "$LOGNAME $$" $TTY Status $STAT PWD $PWD ${X#  }
                        fi
                fi
        fi
}
trap log DEBUG


We left out all *adm users, as SAP with Java normally uses hundreds of embedded profiles and therefore the switching to that one user took sometimes 5 seconds which gave us quite a pain.

 

Good luck on logging 🙂

Advertisements
This entry was posted in aix and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.