[23365] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5584 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 29 14:07:25 2003

Date: Mon, 29 Sep 2003 11:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 29 Sep 2003     Volume: 10 Number: 5584

Today's topics:
        Access Right  for Perlscript to Read Windows EventLog R <pangjo@netzero.com>
    Re: Access Right  for Perlscript to Read Windows EventL <ThomasKratz@REMOVEwebCAPS.de>
    Re: Am I on the right track - timezones <mothra@nowhereatall.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 29 Sep 2003 12:12:02 -0400
From: "Joe" <pangjo@netzero.com>
Subject: Access Right  for Perlscript to Read Windows EventLog Remotely
Message-Id: <nRYdb.1933$op2.294469@news20.bellglobal.com>

I am trying to read the EventLog of different servers on the network.  If I
run the script in a command line, it works well.  But when I try to put the
script into the Web server (IIS in Windows 2000) and run from a web browser,
it works with my local machine only.  I have the following error when I try
to access any remote server:

CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers.  The headers it did return are:
Can't get number of Eventlog records

I think it is a permission issue related to IIS.  I have already given local
admin's right to the account for running applications in Web and logging on
to the web server (ISUR_web01 & IWAN_web01).  Also, I changed the account
for starting up the Web server to a domain admin's account from a system
account.  But still I cannot make it work.

Any help would be appreciated.

Joe






#=============================
use Win32::EventLog;

# put in server name; it works for local server,
# but not any remote machines, have to fix it.

 my $servername = "\\server1";


 $handle=Win32::EventLog->new("System", $servername")
        or die "Can't open Application EventLog\n";
 $handle->GetNumber($recs)
        or die "Can't get number of EventLog records\n";
 $handle->GetOldest($base)
        or die "Can't get number of oldest EventLog record\n";

 print "Content-type: text/html\n\n";
 print "<HTML>\n<BODY>\n<H3>\n\n";

 while ($x < $recs) {
        $handle->Read(EVENTLOG_FORWARDS_READ|EVENTLOG_SEEK_READ,
                                  $base+$x,
                                  $hashRef)
                or die "Can't read EventLog entry #$x\n";
        if ($hashRef->{Source} eq "EventLog") {
                Win32::EventLog::GetMessageText($hashRef);
                print "Entry $x: $hashRef->{Message}<P>\n";
        }
        $x++;
 }

print "</H3>\n</BODY></HTML>";




------------------------------

Date: Mon, 29 Sep 2003 19:29:49 +0200
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: Access Right  for Perlscript to Read Windows EventLog Remotely
Message-Id: <3f786c65.0@juno.wiesbaden.netsurf.de>

Joe wrote:

> I am trying to read the EventLog of different servers on the network.  If I
> run the script in a command line, it works well.  But when I try to put the
> script into the Web server (IIS in Windows 2000) and run from a web browser,
> it works with my local machine only.  I have the following error when I try
> to access any remote server:
> 
> CGI Error
> The specified CGI application misbehaved by not returning a complete set of
> HTTP headers.  The headers it did return are:
> Can't get number of Eventlog records
> 
> I think it is a permission issue related to IIS.  I have already given local
> admin's right to the account for running applications in Web and logging on
> to the web server (ISUR_web01 & IWAN_web01).  Also, I changed the account
> for starting up the Web server to a domain admin's account from a system
> account.  But still I cannot make it work.

You don't need to be admin to read a remote eventlog. The account the 
script runs with only needs SeNetworkLogon privs on the machine it 
should read the eventlog from (at least for the system and application 
eventlog; the security eventlog is another thing). This account has to 
be a domain account.

I assume the script is *not* running under the user you think it is. 
Perhaps printing out the environment variable USERNAME from the script 
will make this clearer (I guess this will be one of the local accounts 
I???_web01 that have no right whatsoever on the target machines).

Anyway, this is not a Perl question. I would recommend joining a IIS 
group.

[snipped code]

Thomas



------------------------------

Date: Mon, 29 Sep 2003 07:44:07 -0700
From: "Mothra" <mothra@nowhereatall.com>
Subject: Re: Am I on the right track - timezones
Message-Id: <3f76f5ff$1@usenet.ugs.com>

Hi Jon,

"Jon" <jon18_uk2002@yahoo.co.uk> wrote in message
news:83bd902f.0309281401.5293f14a@posting.google.com...
> Hello,
>
> I am trying to take a date (day/month/year) and time (hour:min) from
> the user, and also a timezone which that date/time is based on.  I
> then need to pull all logs out of a database which happens on that
> supplied date and time.

[snipped]
Please take a look at the DateTime project.
 http://datetime.perl.org/

> Thank you in advance for any help,
>
> Jon.

Hope this helps

Mothra




------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5584
***************************************


home help back first fref pref prev next nref lref last post