Clear system logs in Event Viewer

My system logs in the event viewer are always full every now and then. A dialog will often pop up to say system log full. Thus it is quite troublesome to clear them manually. I would like to generate a script to clear the system and application log every week. Do you have any suggestion to go about doing it?

I would like to learn to write scripts in NT. Do you know where to get the resource or books on this area? Recently, I want to write a script to view the v$session in the database.
So I tried to execute the sever manager by putting C:\orant\Bin\svrmgr23.exe in the script. But I do not know how to pass the parameter such as "connect internal" to svrmgr. In unix this can be done using back file like this
svrmgrl << !
connect internal
spool session.log
#another script which select from #v$session
@session
spool off
exit.

How to do this in NT?
rosetalkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rosetalkAuthor Commented:
Edited text of question.
0
j2Commented:
As for event viewer, just set it to "overwrite as needed" then the old entries will be deleted when the log is full.

in nt you can "command < file" but stdin / out on NT is pretty broken, so most commands have a switch for "use this file" look inte manuals.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rosetalkAuthor Commented:
I have tried your method but is doesn't seem to work.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

j2Commented:
As i said.. "it doesnt work in most cases". Read the manual and look for an option to read from a file.
0
carmineCommented:
Why don't you use:

....\svrmgr23 @cmdfile

Where cmdfile.sql contains:
connect internal
spool session.log
#another script which select from #v$session
@session
spool off
exit


Mark
0
rosetalkAuthor Commented:
Thanks, I will try it out
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.