Operating System - HP-UX
1753851 Members
7748 Online
108807 Solutions
New Discussion

Trying to extract last months entries from sulog

 
tazhasan
Occasional Advisor

Trying to extract last months entries from sulog

Hi

The auditors want us to extract 'last months' SU's to oracle.  ie on 1 Dec 2018, I want to generate an email that reports Nov 1 - 31 2018 activities, for example.

Following on, on 1 Jan 2019, I need to report on Dec 1 - 31 2018.  

I have a crude 3 liner that works in the current year (just about):

last_month=$(date +%m | awk -F '/' '{$NF--}1' OFS='/')
this_year=$(date +%Y)

grep "SU $last_month" /var/adm/sulog | grep orar12 | /usr/bin/mailx -s "SUs to orar12 for $last_month/$this_year" recipient@email.address

Hope you can help.

Regards

Tariq

 

1 REPLY 1
RajUX
Advisor

Re: Trying to extract last months entries from sulog

I believe you could schedule cron jobs to run at every monthend at 12 midnight to copy the sulog with date, month and year and nullify the existing sulog.In this way, you will have sulog of every month available and can be attached and sent in email.