scripts for rotation and compression of sys logs


 
Thread Tools Search this Thread
Special Forums Hardware Filesystems, Disks and Memory scripts for rotation and compression of sys logs
# 1  
Old 02-25-2002
scripts for rotation and compression of sys logs

As a UNIX newbie, how can I create a (cron)script that rotates my syslogs on AIX 4.3.3 on a 24 hour basis and compresses the old logs ?

TIA !
# 2  
Old 02-26-2002
You can do this :

Input this command into root cron :

30 23 * * * /rotate_syslog

This command execute the rotate_syslog at 23:30 o´clock everyday.

Script /rotate_syslog example :

#! /bin/sh
#
LOG=your_syslog
cd /syslog_path
test -f $LOG.3 && mv $LOG.2 $LOG.4
test -f $LOG.2 && mv $LOG.2 $LOG.3
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
mv $LOG $LOG.0
cat /dev/null > $LOG
chmod 644 $LOG


Witt

Last edited by witt; 02-27-2002 at 02:40 AM..
witt
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies

2. Programming

Interactive Python 3.5+ sys.stdout.write() AND sys.stderr.write() bug?

(Apologies for any typos.) OSX 10.12.3 AND Windows 10. This is for the serious Python experts on at least 3.5.x and above... In script format sys.stdout.write() AND sys.stderr.write() seems to work correctly. Have I found a serious bug in the interactive sys.stdout.write() AND... (2 Replies)
Discussion started by: wisecracker
2 Replies

3. Shell Programming and Scripting

Time rotation

Hi, I'm trying to figure out Rsync Timings from my logs of the script. For this I have enabled a wrapper script to log start time and end time of the script so that I can catch the Rsync lapsed time. Below are the code lines I'm trying to use for Rsync time . INPUT is |Running the... (3 Replies)
Discussion started by: busyboy
3 Replies

4. UNIX for Dummies Questions & Answers

Best way to publish logs and reports from shell scripts?

Hello, I have been searching for some advice on this. I'm new to linux in a sys-admin kind of role, and I'm often asked to get information by running basic commands in the linux shell. For example, how many jobs running, grep a number of files, run a random program and output the results,... (4 Replies)
Discussion started by: allagher8
4 Replies

5. AIX

Need help with warn messages in sys logs

Hello, Can you please look into the below warning messages on AIX sys logs ? is this related to application ? do we need to do anything from OS side ? we're running WAS on this LPAR. Feb 12 03:47:48 myserver user:warn|warning IBM Java: JVMJ9VM134W The system fullcore option is set to... (5 Replies)
Discussion started by: System Admin 77
5 Replies

6. Solaris

Log rotation

Hi All! I seem to have a problem with log rotation, unless I am doing something wrong, I have type the following command for testing purposes to see if the -s option works but he did not: logadm -w /var/adm/messages -C 8 -c -s 512k -t '/var/adm/messages.$n' -z 1 the file is now at this... (7 Replies)
Discussion started by: fretagi
7 Replies

7. UNIX for Dummies Questions & Answers

Log Rotation

Hi Guys, Good morning, I just want to know and collect ideas on this one. Regarding rotation of logs as I've observed it's not consistently functioning. I have a server with 8 Partitions, each partition has a dedicated directory for the logs that is needed and I set it every 5mins (300secs) the... (1 Reply)
Discussion started by: rymnd_12345
1 Replies

8. UNIX for Advanced & Expert Users

Sun Cluster log rotation & compression

I currently have in root's crontab: 20 4 * * 0,3 /usr/cluster/lib/sc/newcleventlog /var/cluster/logs/eventlog 20 4 * * 0,3 /usr/cluster/lib/sc/newcleventlog /var/cluster/logs/DS 20 4 * * 0,3 /usr/cluster/lib/sc/newcleventlog /var/cluster/logs/commandlog there is no man page on... (1 Reply)
Discussion started by: rkruck
1 Replies

9. Shell Programming and Scripting

User1 runs User2 scripts and updates logs?Is it possible?

Guys I have an odd request in hand. User1 Group1,Group2 User2 Group2,Group1 As can be seen ,both users belong to each other's group as well. Now User1 is holding some scripts(in a folder) on which perms are: 750 ..meaning User2 can read and execute but the execution is never successful... (1 Reply)
Discussion started by: ak835
1 Replies

10. Shell Programming and Scripting

Grep yesterday logs from weblogic logs

Hi, I am trying to write a script which would go search and get the info from the logs based on yesterday timestamp and write yesterday logs in new file. The log file format is as follows: """"""""""""""""""""""""""... (3 Replies)
Discussion started by: harish.parker
3 Replies
Login or Register to Ask a Question