improve sulog


 
Thread Tools Search this Thread
Operating Systems AIX improve sulog
# 1  
Old 04-18-2011
improve sulog

I just wrote a very small script that improves readability on system sulog. The problem with all sulog is there is lack of clarity whether the info you are looking at is the most current. So if you just need a simple soution instead of going thru the trouble of writing a script that rotate logs and figure out number of days on the time stamp or install a program to do it, just grep on the fly for what is important that you want like ???-root or ???-oracle and append the system timestamp into the sulog for historical future references.

Code:
while true
do
  TODAY=`date`
  LASTROOT=`tail -1 ./sulog | grep "\-root" > /tmp/testroot`
  if [[ -s /tmp/testroot ]] then
    echo "found :- `tail -1 ./sulog`" | mailx -s "list of users su - root" sparcguy@admin.com
    echo $TODAY >> ./sulog
  else
    echo "not found"
  fi
  sleep 1
done


Last edited by Scott; 04-18-2011 at 02:53 AM..
This User Gave Thanks to sparcguy For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Unable to set ACLs on sulog - need to grant read permission to a normal user on AIX 6.1

Hi, I need to grant read permission to a normal user on sulog file on AIX 6.1. As root I did acledit sulog and aclget shows "extended permissions" as "enabled" and normal user "splunk" has read permissions. When I try to access sulog as splunk user it won't allow and aclget for splunk user... (6 Replies)
Discussion started by: prvnrk
6 Replies

2. Shell Programming and Scripting

How to improve an script?

Gents. I have 2 different scripts for the same purpose: raw2csv_1 Script raw2csv_1 finish the process in less that 1 minute raw2csv_2 Script raw2csv_2 finish the process in more that 6 minutes. Can you please check if there is any option to improve the raw2csv_2. To finish the job... (4 Replies)
Discussion started by: jiam912
4 Replies

3. Solaris

/var/adm/sulog does not showing year

Hi, I would like to know is there any way to capture the year in /var/adm/sulog file in solaris 10? Please suggest (2 Replies)
Discussion started by: manoj.solaris
2 Replies

4. Solaris

hostname or ip information on sulog

Hi, more than one user login the our solaris 10 systems with same user account by using ssh connection. i wanna see ip or hostname information of them on sulog instead of it's terminal number. is this possible? current sulog is like that SU 02/06 08:59 + pts/1 operation-vuser SU 02/07 14:27... (1 Reply)
Discussion started by: sdkbjk
1 Replies

5. Linux

SULOG for LINUX

How to enable sulog activity in LINUX like /var/adm/sulog in Solaris , AIX..... I have added SULOG_FILE /var/log/sulog in /etc/login.defs ...but it is not working ... Thanks a lot for help (1 Reply)
Discussion started by: Anu_1
1 Replies

6. Solaris

How to select last 7 days entry from SULOG or LAST command

Hi All, I need to get last 7 days log entries from sulog. The same has to be done for the last command. for ex: when i search for a user "abc" in sulog, i only want to check his entries for the last 1 week. The same has to be done for last command. Can anyone suggest some tips. ... (0 Replies)
Discussion started by: navdeepan
0 Replies

7. UNIX for Dummies Questions & Answers

Improve Performance

hi someone tell me which ways i can improve disk I/O and system process performance.kindly refer some commands so i can do it on my test machine.thanks, Mazhar (2 Replies)
Discussion started by: mazhar99
2 Replies

8. Shell Programming and Scripting

improve this?

Wrote this script to find the date x days before or after today. Is there any way that this script can be speeded up or otherwise improved? #!/usr/bin/sh check_done() { if then daysofmth=31 elif then if ... (11 Replies)
Discussion started by: blowtorch
11 Replies

9. UNIX for Dummies Questions & Answers

sulog

Hello, the sulog file on solaris does not record the user's attempts. do i have to delete and create a new one or there is a better way? in addition on the current sulog file is shown the month/day of the user's attempt but i like to see the year also. there is a way to see the year or more... (2 Replies)
Discussion started by: grep
2 Replies

10. Shell Programming and Scripting

Can I improve this script ???

Hi all, Still a newbie and learning as I go ... as you do :) Have created this script to report on disc usage and I've just included the ChkSpace function this morning. It's the first time I've read a file (line-by-bloody-line) and would like to know if I can improve this script ? FYI - I... (11 Replies)
Discussion started by: Cameron
11 Replies
Login or Register to Ask a Question