The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
parsing logfiles (performance issue) subin_bala Shell Programming and Scripting 4 05-06-2008 02:35 AM
Logfiles E-mailed deep_kol Shell Programming and Scripting 4 06-25-2007 05:51 PM
Output all commands to logfiles ??? fawqati UNIX for Advanced & Expert Users 2 06-21-2006 04:47 AM
Controlling I/O bionicfysh Filesystems, Disks and Memory 1 10-01-2003 01:23 AM
Logfiles brahill UNIX for Dummies Questions & Answers 3 10-16-2000 03:37 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-07-2002
nhatch nhatch is offline
Registered User
  
 

Join Date: Aug 2002
Location: London, England
Posts: 85
Question Controlling logfiles

I support an app that outputs alert and audit messages to one log file (vendor says they can't be separated). The script that I have written takes a copy (mv cmd) of the file to do the separation and reformatting. I have a problem that I loose records (messages are being written constantly, upto 3+ a second) between doing the mv and touch command on the log file. What could I do to stop these records being missed? feed the output straight into a script? Can I name pipes (this should allow for the script to read one message at a time)? any ideas would be great. Easier the better.
  #2 (permalink)  
Old 08-07-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,124
Shutdown the app. Save the old log. Restart the app.
  #3 (permalink)  
Old 08-07-2002
nhatch nhatch is offline
Registered User
  
 

Join Date: Aug 2002
Location: London, England
Posts: 85
Sounds good....I would luv to turn it off and keep it off but it is in a 24x7 app and I would have to turn it off every 10 minutes in order to keep file size down (plus, it takes about 3-5mins to start and stop).

How do you become a UNIX Daemon? Who do I have to fight.....bring it on.
  #4 (permalink)  
Old 08-07-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,124
I guess it must be opening the log file in append mode for each write since your move works at all. So maybe you can something like this....

cd /log/directory
kill -STOP $pid
mv log olog
kill -CONT $pid
sleep 3

That sleep is needed because the app may have opened the old log file prior to the first kill. We need to give time to do the write after the second kill.

But the real answer is that the app needs to be re-written to this by itself.
  #5 (permalink)  
Old 08-07-2002
auswipe's Avatar
auswipe auswipe is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2001
Location: Wide Awake Wylie, Texas
Posts: 535
How about a script that when fired up, counts the number of lines in the log (`wc -l`) and then starts at the first of the file and has it processes log entries it deletes the log entries until the line count of the log file has been reached?

That way, you process messages, reduce the size of the log, but will not miss any added log entries, and because you start with the initial count of the lines of the log, you won't miss new log entries.

The only problem that I can think of is a situation where you delete and the app writes at the exact same time.
  #6 (permalink)  
Old 08-08-2002
binhnx2000's Avatar
binhnx2000 binhnx2000 is offline
Registered User
  
 

Join Date: Jul 2002
Location: France
Posts: 78
Wink

All log file to config at: /etc/syslog.conf = = > You can view and edit it. If you want control a log file:

- Add
- Del
- Stop
....
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:46 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0