Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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; } }

In reply to Re: Re: Win32::Eventlog Issues: Access Denied, Incorrect log size by softworkz
in thread Win32::Eventlog Issues: Access Denied, Incorrect log size by OzzyOsbourne

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-16 17:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found