script to move logs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script to move logs
# 1  
Old 10-05-2008
script to move logs

Does anyone have a good script to move log files from a cron?

There are a lot of logs, about 100 or more and they are constantly
being written too.
# 2  
Old 10-05-2008
The better way is to use syslog for that.
# 3  
Old 10-05-2008
Quote:
Originally Posted by photon
Does anyone have a good script to move log files from a cron?

Do you not have a logrotate command?
# 4  
Old 10-07-2008
it turns out the problem is a little more serious.

df -h
/ is 51G used
/proc is 0k

du -shd /
/ is 38G used

du -shd /proc
/proc is 18G

because this is a zone on the root file system, I think
there is something in another zone or global zone that
is causing file system to grow but I can't find it.

Only suspicious directory is proc.

Does anyone know how to find the culprit or solution here?
# 5  
Old 10-07-2008

/proc does not take up any space; it is a virtual file system only.

Do you have a logrotate command?
# 6  
Old 10-07-2008
which logrotate says no.

There are three kinds of logs.

1.) Logs that do not end.

application1.log
application2.log

I am planning to copy these to backup drive as follows:
cp application1.log /backup/application1.log
cp /dev/null applications1.log

2.) some logs that when they hit 50M create 7 files.

file.log
file.log.0
file.log.1
...etc...
file.log.7

I wont really be doing anything here as it seems these logs
are under control.

3.) others create daily logs such as:

file.2008-10-01.log
file.2008-10-02.log

I created a perl script to move all these files to backup drive when
older that three days.


However, I still can't find the extra 11-12G that df shows and du does not.
# 7  
Old 10-07-2008
Quote:
Originally Posted by photon
However, I still can't find the extra 11-12G that df shows and du does not.

du and df measure different things. They will not show the same numbers.
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. Red Hat

Profile.d script logs out

Hi, I included a command set -o vi & sudo -l user -c script in profile.d and /etc/profile. unfortunately the script has some command that logs me out every time I try to login from all users including root user. this is happening from GUI. can I login to prompt directly? or is there an... (7 Replies)
Discussion started by: ahmedwaseem2000
7 Replies

3. UNIX for Dummies Questions & Answers

Need script to rotate logs

I have few solaris-10 non global zones, where one application is writing some logs to /var/ovd/ConfigLogs. It keeps increasing all the time, as it is needed by application team as of now. I want a small script, which I can configure in cronjob, which should : - Run every Saturday 10 PM - Copy... (5 Replies)
Discussion started by: solaris_1977
5 Replies

4. Shell Programming and Scripting

Script for monitoring logs

hi, i'm using unix solaris 5.8. I have to write a shell script for monitoring logs. whenever the logs are not updated more than one hour an alert will be send to my mail. I'm new to Unix, so could anyone help me to find this. (3 Replies)
Discussion started by: Arasu
3 Replies

5. Shell Programming and Scripting

Script to check logs

I have 5 log files under different directores . say for eg abc under /home/dir1 , xyz under home/dir2 . is there a script that i can run from say /home that searchers all these files for string or combination of strings and write to a file eg search file by timestamp|keyword o/p in a file (6 Replies)
Discussion started by: Nevergivup
6 Replies

6. Shell Programming and Scripting

Shell Script for GC Logs

Hi, I have a strange situation here, I want to archive gc.logs file, generated by a java application, the strange thing about gc.log file is is doesn't have any time/date stamp appended to it unlike other logs (catalina/access/error) and one more strange thing is when ever the application is... (6 Replies)
Discussion started by: Neeryan
6 Replies

7. Shell Programming and Scripting

script for reading logs of a script running on other UNIX server

Hi, I have a script, running on some outside firwall server and it's log of success or failure is maintained in a file. I want to write a script which ftp that server and reads that file and checks the logs and if failure , I will send mail notification. Please let meknow if I am not... (1 Reply)
Discussion started by: vandana.parwani
1 Replies

8. Shell Programming and Scripting

Lots of logs to move....don't remove if open

I have a ksh script that currently moves a day's worth of log files (about 15,000) files to a different directory. The issue is that about 100 of these files are still open for write when this happens. I need an efficient way to ensure that these files aren't open without doing an lsof on each... (7 Replies)
Discussion started by: nestafaria
7 Replies

9. 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

10. UNIX for Dummies Questions & Answers

Script for reducing logs

Hi, I'm not good in scripting, maybe someone can help me. I need to delete the lines that contains the last month date from a text file. Each line has the following date format: So the script should check the actual month, and delete all the lines that contains the past month. The script runs... (2 Replies)
Discussion started by: piltrafa
2 Replies
Login or Register to Ask a Question