Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Win32::Eventlog Issues: Access Denied, Incorrect log size

by softworkz (Monk)
on Jul 24, 2002 at 18:27 UTC ( [id://184975]=note: print w/replies, xml ) Need Help??


in reply to Re: Win32::Eventlog Issues: Access Denied, Incorrect log size
in thread Win32::Eventlog Issues: Access Denied, Incorrect log size

Here's my two cents... Change the code around to suit your needs. This code will do away with opening a file of servers (nodes in my case), no sense in creating more files to make a mess of things? ya know?

By the way this has been tested on windows 2000 server 2000 pro and windows Xp

Hope it helps!
#!/usr/bin/perl -w use strict; use Win32::EventLog; my @nodes = qw(NODE1 NODE2 NODE3); foreach my $node(@nodes) { &GetEvents($node); } sub GetEvents { my($myServer) = @_; my($date)=join("-", ((split(/\s+/, scalar(localtime)))[0,1,2,4])); my($dest); my @logs =qw(Security System Application); foreach my $eventLog (@logs) { my $handle=Win32::EventLog->new($eventLog, $myServer) || die " +Can't open Application EventLog on $myServer $!"; $dest="C:\\Perl\\scripts\\$eventLog\\$date.evt"; $handle->Backup($dest) || die "Could not backup and clear the +$eventLog EventLog on $myServer ($^E)\n"; $handle->Close; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://184975]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-19 15:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found