RE: NT Event Logs
by "Charlton, Mark" <Mark.Charlton(at)saint-gobain.com>
|
| Date: |
Wed, 9 May 2001 10:25:40 -0400 |
| To: |
"'Rich Bowen'" <rbowen(at)rcbowen.com>, "'hwg-languages(at)hwg.org'" <hwg-languages(at)hwg.org> |
| |
todo: View
Thread,
Original
|
|
Thanks for both your help, and the script!
This is guaranteed consistent. It happens 100% of the time I try. Until I
put in those print lines, and it now works perfectly corrrectly.
The scheduler has both the full path of the perl file and the script. the
exact command runs in dos. It is definately a permissions thing. If I run
it as administrator it runs, if I run it as the user I have created it
doesn't run properly. There are some advanced permissions that I have
failed to locate, so I will go back to running it as an admin.
I give up, I suppose it is windows at the end of the day...
-----Original Message-----
From: Rich Bowen [mailto:rbowen(at)rcbowen.com]
Sent: Tuesday, May 08, 2001 10:54 PM
To: Charlton, Mark; 'hwg-languages(at)hwg.org'
Subject: Re: NT Event Logs
On Tue, 8 May 2001 11:00:00 -0400, Charlton, Mark said:
> Last month I go this perl script via HWG to back up my NT event logs, and
I
> have been trying to use it, however when I run it I have to run it twice
to
> get it to output all the NT event logs. I run it the first time and it
> given me the system and security logs. the second time I run it I get
the
> application log output, but the first 2 output logs are not altered.
>
> Does anyone have any ideas why, or how I can fix this?
Well, since I'm the one that gave you the script, I suppose I should try to
help you! :-)
Unfortunately, I don't use Windows any more, so I may be of limited help. I
used this program for a long timem and never experienced the problem that
you
describe. And I can't imagine, from either the Perl side or the NT side, why
this would be happening. This is consistent behavior? Add some print
statements
in, to tell you what it is trying to do. See below.
> The other problem is that when I schedule it it doesn't run at all. I
have
> created an NT user for the task, but cannot determine what permissions it
> requires for it to run the perl code. The user has RX access to the
entire
> perl install directory and change to the script directory.
This is perhaps a path thing. When you run the program from the scheduler,
it
becomes blissfully unaware of your path. Make sure in your scheduled job
that
you specify the full path to Perl, as well as the full path to the script
file.
>
> #!/usr/bin/perl
> use Win32::EventLog;
> use Time::CTime;
> use strict;
> my ($Event, @timearray, $filename,
> $day, $month);
> for ('System', 'Security', 'Application') {
print "Attempting to contact the $_ log\n";
> $Event = new Win32::EventLog ("$_", "");
print "Got the connection to the $_ log\n"l
> @timearray=localtime(time);
> $month = sprintf ('%.2d', $timearray[4]);
> $day = sprintf ('%.2d', $timearray[3]);
> $filename = 'c:/EventLogs/' . ($timearray[5]+1900) . '_' .
> $month . '_' . $day . '_' . $_ . '.events';
> $Event->Clear($filename);
print "Cleared out the $_ log.\n";
> `gzip -9 $filename`;
> } # End for
>
--
Rich Bowen - rbowen(at)rcbowen.com
Have trouble remembering things?
http://www.idforgetmyhead.com/
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.