LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-20-2009, 11:13 AM   #1
christopher_m_bennett
LQ Newbie
 
Registered: Sep 2009
Posts: 2

Rep: Reputation: 0
Script to archive logs


I'm looking for a simple script to move and archive logs created by a windows application. The application starts a new log when it reaches a certain size. I want to move all logs except the one currently being written to so they can be processed and archived. I cant suspend the windows app and move all of them so I need a reliable way to identify the one still being written and skip that one. Any ideas would be helpful

Thanks
 
Old 09-20-2009, 11:43 AM   #2
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
How are the logs getting onto the Linux machine? Over a Samba share, or is the program running under WINE?

Regardless, you could use logrotate to archive the logs past a certain size and prevent the log from being removed while in use. logrotate will work with any file you point it to, it doesn't specifically have to be a Linux log file.
 
Old 09-20-2009, 01:15 PM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,040

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Yep, logrotate.
 
Old 09-21-2009, 03:26 AM   #4
christopher_m_bennett
LQ Newbie
 
Registered: Sep 2009
Posts: 2

Original Poster
Rep: Reputation: 0
The files are on a share on the windows machine. The windows app actually does the log rotation, when the file size gets to 100k it closes the log and starts a new one so all I really need to do is move the files once an hour or so. The only problem is I cant move the one that is currently being written to so I need some way to skip that file.
 
Old 09-21-2009, 08:56 AM   #5
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
Well, certainly the filenames must be different once the log is rotated out. Whatever operations you perform (even if it is as simple as moving them to a different directory), you should just have to specify the rotated-out filename or extension.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Archive of Web Logs for Urchin. wademac Linux - Newbie 2 07-24-2009 12:37 PM
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 04:19 AM
How about a shell script archive? Autocross.US LQ Suggestions & Feedback 2 12-05-2006 06:36 PM
FTP archive logs madunix Programming 0 03-31-2004 11:58 PM
archive system logs? ANU Linux - General 3 12-01-2003 11:48 AM


All times are GMT -5. The time now is 05:17 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration