?
Solved

Any way to monitor a log file size?

Posted on 2003-02-21
12
Medium Priority
?
141 Views
Last Modified: 2010-04-13
In a windows 2000 server environment - I am running a piece of server software that writes to a text based log file. The server log file grew to 9.6 Mb in 6 months (no major problem). However the system started a loop and created text entries every 0.5 second to this file.
Subsequently the log file grew to 2.25Gb in 24 hours! Major problem as this the hung the server and caused system failure.

Does anyone know of a way I can monitor the size of this filel and poll its size every 15-30 mins and if the size has increased by say 1Mb since the last poll, shut down the server services?
I run a batch script to copy of the logfile every week but being a 24/5  Helpdesk, I cant copy off while system is live, and can't shut down the software except at weekends!
0
Comment
Question by:andy_i
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 10

Expert Comment

by:makerp
ID: 7992813
write a windows scriting host file to do it then use the AT command (or the GUI scheduler) to schedule it

Set fso = CreateObject("Scripting.FileSystemObject")
Set fileobj = fso.GetFile("filemon.vbs") ' change this to be your test log file
IF(fileobj.Size > 5000)THEN
     Set WshShell = Wscript.CreateObject("Wscript.Shell")
     WshShell.Run "NET STOP my_service_name"
END IF
0
 

Author Comment

by:andy_i
ID: 7993242
Thanks for the idea,
But unfortunately cant run VBS script on the network! Rules and Regs!
Best we could hope for would be some kind of Batch script - but I don't know of anything that will allow me to do that kind of comparison
0
 

Author Comment

by:andy_i
ID: 7993281
Have also tried to use the "comp" command however this is too indepth (byte by byte comparison) and creates high CPU loading.

0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 2

Expert Comment

by:nomisp
ID: 7993781
This is a bit of a work around and not perfect but it should stop your server crashing. If you create a user eg. 'logfile' and give ownership of the log file to that user you can then set Disk quotas to warn you in the event log when the file reaches a certain size and to stop it exceeding a certain size. As i said, not perfect but it does protect your system from being filled up by this file.
0
 

Author Comment

by:andy_i
ID: 7993950
The log file is effectively deleted at each w/e backup and a new one created when the system restarts. As the new one is created to exactly the same file name could the ownership be tricked into thinking the new file (system generated therefore owner=admin) was the old one?
Could it be possible to take ownership on an automatic basis for the newly created file?

Many thanks for the thoughts/suggestions/comments
0
 
LVL 2

Expert Comment

by:nomisp
ID: 7994038
Afraid thats a bit beyond me. I do know that you can't give ownership of a file to a user or user account, it is up to that account to take ownership. Whether this could be done programaticly i don't know.
0
 

Author Comment

by:andy_i
ID: 8025548
many thanks to nomisp and makerp
I'm trying to find ways to split the points and grade answers as both of you have given time/ideas/help.

Unfortunately I can't implement WSH and I'm still trying to find a way to get this file automatically owned!

May try and find a way to take ownership of the file as per nomisp's last post and instead of deleting the entire file just delete the entire contents..Hmmm could be a bit of a sticky one here!

Thanks again, points & grades on the way,
Andy
0
 

Expert Comment

by:SpideyMod
ID: 8025679
Points reduced for split.  Please post a points for expertname re 20523706 for the other expert and return back here to notify.

SpideyMod
Community Support Moderator @Experts Exchange
0
 
LVL 2

Expert Comment

by:nomisp
ID: 8025683
Just a thought, you could try running your app using 'runas /user'(see below) from a command prompt. Perhaps the log file would then be owned by the user specified in the runas command.

e.g in a command prompt type runas /user:domain\user "Path to program"

I believe that it's only the administrator account, not accounts in the administrators group that are unrestricted using disk quotas.
0
 
LVL 2

Accepted Solution

by:
nomisp earned 200 total points
ID: 8025720
Just a thought, you could try running your app using 'runas /user'(see below) from a command prompt. Perhaps the log file would then be owned by the user specified in the runas command.

e.g in a command prompt type runas /user:domain\user "Path to program"

I believe that it's only the administrator account, not accounts in the administrators group that are unrestricted using disk quotas.
0
 

Author Comment

by:andy_i
ID: 8025791
program runs as a service so may work. would have to grant "logfile" user rights to start services..Hmmm can see getting into sticky zone due to tight rules and regs on server side configuration changes away from standard design. Wish I was back working in the server rooms as opposed to being a Project Manager on this one!!!

Anyway have got the points split. I'll use your answer here nomisp, and I have already posted 50 point question
http://www.experts-exchange.com/Operating_Systems/Win2000/Q_20530528.html for points for makerp

http://www.experts-exchange.com/Community_Support/Q_20530516.html
Many thanks for your help.
0
 

Author Comment

by:andy_i
ID: 8025805
All I need to do now is to try and get all this implemented!
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
The top devops trends for 2017 are focused on improved deployment frequency, decreased lead time for change and decreased MTTR.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question