Page 1 of 1 1
Topic Options
#111843 - 2004-01-15 03:58 PM BackupEventLog problems
Jason Gauthier Offline
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
#111844 - 2004-01-15 04:25 PM Re: BackupEventLog problems
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Does the path "C:\Logs\" exist on the machine where the event log exists? My guess is that it does not. You cannot backup to a remote path.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#111845 - 2004-01-15 04:36 PM Re: BackupEventLog problems
Glenn Barnas Administrator Offline
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! \:D

Top
#111846 - 2004-01-15 04:36 PM Re: BackupEventLog problems
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Furthermore, the path must be local to the computer where the eventlog resides, thus when backing up on a remote server, it's the local path on the remote server.
_________________________
There are two types of vessels, submarines and targets.

Top
#111847 - 2004-01-15 04:43 PM Re: BackupEventLog problems
Jason Gauthier Offline
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
#111848 - 2004-01-15 04:59 PM Re: BackupEventLog problems
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
See the KiXtart Manual! It does support backing up eventlogs on remote systems. However, the filepath to back up to MUST exist on the remote system as well.

Also, you state
Quote:

I read that BackupEventLog will not backup to a remote system, so I never tried.



but then your test code does exactly that:
Code:

DEL C:\Logs\test.evt
$rc=BackupEventLog("\\Server7\System", "C:\Logs\test.evt")
? $rc



You code is also flawed as it seems to indicate that you try to back up a remote eventlog to a local filepath!

You also never state the error codes you get.

_________________________
There are two types of vessels, submarines and targets.

Top
#111849 - 2004-01-15 05:09 PM Re: BackupEventLog problems
Jason Gauthier Offline
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
#111850 - 2004-01-15 05:13 PM Re: BackupEventLog problems
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Reread my first post.
Quote:

Does the path "C:\Logs\" exist on the machine where the event log exists?




You are in fact trying to back up to a remote path. To the remote server, your local "C:\Logs\" IS a remote path. Create the folder "C:\Logs\" on the server that has the log and try the script again.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#111851 - 2004-01-15 05:15 PM Re: BackupEventLog problems
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Actually Jens, he did mention the error.
Quote:

My understanding is that 3 is: ERROR_PATH_NOT_FOUND


_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#111852 - 2004-01-15 06:50 PM Re: BackupEventLog problems
Jason Gauthier Offline
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
#111853 - 2004-01-15 06:53 PM Re: BackupEventLog problems
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes__1300-1699_.asp
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.07 seconds in which 0.036 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org