#111843 - 2004-01-15 03:58 PM
BackupEventLog problems
|
Jason Gauthier
Fresh Scripter
Registered: 2003-04-02
Posts: 10
Loc: Dayton, OH
|
Well, I'm stumped. My end goal is to create a script to backup and clear the event logs on my servers. However, I can't even get a simple call to BackupEventLog to work as expected. I've checked manuals, references, and scripts. I'm not doing anything -wrong-. But something is broken. If you have any ideas, I'd be happy.
Here's my very small test code: DEL C:\Logs\test.evt $rc=BackupEventLog("\\Server7\System", "C:\Logs\test.evt") ? $rc
DEL C:\Logs\test.evt $rc=BackupEventLog("System", "C:\Logs\test.evt") ? $rc
The first backs up a server, the second my PC. My result is always:
3 0
My understanding is that 3 is: ERROR_PATH_NOT_FOUND So, I *know* it's not the output file. So it has to be the server pathing. I've tried numerous servers, all the with same result. The servers name are legit, DNS is proper, and I'm a domain admin. I've tried this with: KiXtart 2001 **Release Candidate 3** 4.00 (Copyright 2001 Ruud van Velsen) and KiXtart 2001 4.20 (Copyright Ruud van Velsen 2002) Thanks!
Jason
|
|
Top
|
|
|
|
#111845 - 2004-01-15 04:36 PM
Re: BackupEventLog problems
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
|
The error is from the remote server dump. It appears the local dump is working.
Check out this post, which is a univeral log rotation tool. There's a secting of the config file specifically to rotate event log files.
At the end of that post is a small Kix script that does the actual event log dumping. The ELDump script we use now is slightly different, as it dumps to C:\temp, and then copies the log files to a remote server for automated analysis and archiving. The Log Rotate then moves the files from C:\Temp to a local archive that it maintains for 30 days - this allows local troubleshooting.
I'd recommend running the dump on the local machines and copying the results to a central server, rather than dumping remotely from a central server. This way, if your servers are time-synched, all your event logs will contain data for a consistent time period. We run this at 23:59, and generally have very few, if any, events from the few seconds before midnight in the following day's data. Another group at our company dumps from a central server, and the log dumps start at 1am and finish after 5am! Troubleshooting is a nightmare.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
|
Top
|
|
|
|
#111847 - 2004-01-15 04:43 PM
Re: BackupEventLog problems
|
Jason Gauthier
Fresh Scripter
Registered: 2003-04-02
Posts: 10
Loc: Dayton, OH
|
Thanks Les,
I'm not backing up to a remote path. C:\Logs is on my PC and this is running my on my PC.
The script I posted is exactly what I'm running. But it refuses to backup a remote system.
I read that BackupEventLog will not backup to a remote system, so I never tried.
|
|
Top
|
|
|
|
#111849 - 2004-01-15 05:09 PM
Re: BackupEventLog problems
|
Jason Gauthier
Fresh Scripter
Registered: 2003-04-02
Posts: 10
Loc: Dayton, OH
|
This is making sense.
From the reference manual:
Backupfile String indicating the name of the backupfile. Note: the file must not exist. Examples: $rc=BackupEventLog("Application" , "C:\eventbackups\application.evt") $rc=BackupEventLog("\\PDC\Application" , "C:\eventbackups\application.evt")
It never states that when you backup a remote server that it saves the log file on that server. This is where I was failing to understand.
That was the trick. How interesting. Thanks for helping clarify that.
I was under the impression it would backup the specified event log to the specified file on the system running the command.
|
|
Top
|
|
|
|
#111852 - 2004-01-15 06:50 PM
Re: BackupEventLog problems
|
Jason Gauthier
Fresh Scripter
Registered: 2003-04-02
Posts: 10
Loc: Dayton, OH
|
Yup, thanks everyone. I have all 15 or so servers processing properly. Funny how things work. It's quite nice.
My only issue, is one server's application log returns 1450.
I can't find this in the error file. Anyone know what it is?
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 756 anonymous users online.
|
|
|