J
Joe
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>";
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>";