473,513 Members | 2,493 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP in Windows. Can I read from the Event Log?

I had no luck in my google search for this answer.
Does anyone know if it's possible to read the entries in the Windows
Event Log of the server running my PHP page? I'm trying to create an
itranet page that lists errors from the server event log.... I'd
prefer a pure PHP solution, but I'd be happy to try other alternatives
that involve call outs to non-PHP code.

Thanks in advance.
- Sergio

Feb 15 '07 #1
7 7331
>I had no luck in my google search for this answer.
>Does anyone know if it's possible to read the entries in the Windows
Event Log of the server running my PHP page?
That sounds like an EXTREME security risk on a shared server and a
security risk if the people who can access your page aren't admins
of the server in question. There's lots of sensitive stuff in
there (like valid usernames).
>I'm trying to create an
itranet page that lists errors from the server event log.... I'd
prefer a pure PHP solution, but I'd be happy to try other alternatives
that involve call outs to non-PHP code.
Does Windows have anything that prints event logs in text form?
The Event Viewer lets you save in text form, but moving the mouse from
PHP is difficult.
Feb 16 '07 #2
That sounds like an EXTREME security risk on a shared server and a
security risk if the people who can access your page aren't admins
of the server in question.
I know that. That's why I mentioned this is an intranet site. I have
the plan in place to restrict access for the right people only. But
thanks for the positive advice anyway :)
Does Windows have anything that prints event logs in text form?
The Event Viewer lets you save in text form, but moving the mouse from
PHP is difficult.
I'm not very experienced with PHP but I can tell you that there will
be no mouse in this scenario. What I'm looking for is some library or
function that I can call, like GetEventLogEntries("Application", 10),
which would return me the last 10 entries in the Applications event
log. I know there are windows API calls deal with the event logs, but
I don;t know how to use them in PHP.

Thanks for the reply.

- Sergio

Feb 16 '07 #3
"sergio-p" <se*******@gmail.comwrote in message
news:11**********************@t69g2000cwt.googlegr oups.com...
>I'm trying to create an
intranet page that lists errors from the server event log.... I'd
prefer a pure PHP solution, but I'd be happy to try other alternatives
that involve call outs to non-PHP code.
The big advantage, it seems to me, of a web based event log viewer would be
that a web interface could be routed over IP to remote locations. If all
you need is local viewing capability over the local intranet, perhaps you
can get by with using the event log viewer to view your remote systems.
Since you need direct RPC access to each system, this would be inherently
more secure than using a web browser, where you might need to specifically
intercept local systems in the router, or use a non-routable IP address such
as 192.168.xxx.xxx. BTW, the account you use for viewing does not need to
be in the admin group, but it will require the "auditing and security log"
permissions on each system whose log will be viewed.

The callouts themselves are not that hard to implement, though it's been a
while since I've done so. Google first for the terms IIS ISAPI Event Log to
see if someone else has already done this. Maybe you'll luck out. Then
pick your language - generally VB, or C++ - and build an isapi dll with the
calls you need. Install that dll on a particular server to export those
functions to php, (or any server side script). That server can then be used
to access all the other servers via the remote capability of the event log
api, or you can run a server on each system you want to monitor. There is
one kicker, though. The text message associated with each event log entry
is normally embedded, as a string table resource, in the DLL that generated
the error, so you must have a copy of the DLL's you care about on the same
system - the IIS server - that you are decoding the events on.

If your software is hard to use or install, you'll find that people won't
use it, and will just walk over to the system they are wondering about. Do
have some way of filtering events by severity and date range. It is tedious
using the event viewer to look through the event logs of several systems on
a regular basis, and even more so using a web interface with a relatively
primitive viewing interface.

So a third solution would be to price out a third party utility for
interpreting and filtering remote event logs, and generating a notification
when a serious error or security breach happens. There are many such
products out there, and I imagine these are in the several hundred to
thousand dollar range. This may turn out to be your best bet in the end,
depending on how busy you are, how much you want to learn, and how much your
time is worth to your boss. If nothing else, download a trial version of
one of these products to get an idea of what features you'll want to
implement. Here's one to get you started:
http://www.gfi.com/lanselm/?adv=52&l...ickid=10739086
--
Mike Russell
www.curvemeister.com/forum/
Feb 16 '07 #4
Hi Mike, thanks for your response.
The reason I wanted a purely PHP is because I have done it before in
ASP.NET and find it EXTREMELY useful for me and the sysadmins in my
company.
You can check the ASP.NET solution I developed over here: http://
www.codeproject.com/aspnet/EventLogRss.asp

So, in the end it spits out RSS, then I can read it using a browser or
RSS reader. I can also re-syndicate and merge a whole group of servers
into a single RSS feed. Having a feed like that is all I need to enjoy
notifications and reporting straight from the RSS reader, no more code
needed from me.

Some developers approached me asking for a PHP version and I'm trying
to help them out.

Thanks
- Sergio
On Feb 16, 2:09 pm, "Mike Russell" <RE-MOVEm...@Curvemeister.comRE-
MOVEwrote:
"sergio-p" <sergio...@gmail.comwrote in message

news:11**********************@t69g2000cwt.googlegr oups.com...
I'm trying to create an
intranet page that lists errors from the server event log.... I'd
prefer a pure PHP solution, but I'd be happy to try other alternatives
that involve call outs to non-PHP code.

The big advantage, it seems to me, of a web based event log viewer would be
that a web interface could be routed over IP to remote locations. If all
you need is local viewing capability over the local intranet, perhaps you
can get by with using the event log viewer to view your remote systems.
Since you need direct RPC access to each system, this would be inherently
more secure than using a web browser, where you might need to specifically
intercept local systems in the router, or use a non-routable IP address such
as 192.168.xxx.xxx. BTW, the account you use for viewing does not need to
be in the admin group, but it will require the "auditing and security log"
permissions on each system whose log will be viewed.

The callouts themselves are not that hard to implement, though it's been a
while since I've done so. Google first for the terms IIS ISAPI Event Log to
see if someone else has already done this. Maybe you'll luck out. Then
pick your language - generally VB, or C++ - and build an isapi dll with the
calls you need. Install that dll on a particular server to export those
functions to php, (or any server side script). That server can then be used
to access all the other servers via the remote capability of the event log
api, or you can run a server on each system you want to monitor. There is
one kicker, though. The text message associated with each event log entry
is normally embedded, as a string table resource, in the DLL that generated
the error, so you must have a copy of the DLL's you care about on the same
system - the IIS server - that you are decoding the events on.

If your software is hard to use or install, you'll find that people won't
use it, and will just walk over to the system they are wondering about. Do
have some way of filtering events by severity and date range. It is tedious
using the event viewer to look through the event logs of several systems on
a regular basis, and even more so using a web interface with a relatively
primitive viewing interface.

So a third solution would be to price out a third party utility for
interpreting and filtering remote event logs, and generating a notification
when a serious error or security breach happens. There are many such
products out there, and I imagine these are in the several hundred to
thousand dollar range. This may turn out to be your best bet in the end,
depending on how busy you are, how much you want to learn, and how much your
time is worth to your boss. If nothing else, download a trial version of
one of these products to get an idea of what features you'll want to
implement. Here's one to get you started:http://www.gfi.com/lanselm/?adv=52&l...ickid=10739086
--
Mike Russellwww.curvemeister.com/forum/

Feb 16 '07 #5
"sergio-p" <se*******@gmail.comwrote in message
news:11*********************@l53g2000cwa.googlegro ups.com...
....
You can check the ASP.NET solution I developed over here: http://
www.codeproject.com/aspnet/EventLogRss.asp

So, in the end it spits out RSS, then I can read it using a browser or
RSS reader. I can also re-syndicate and merge a whole group of servers
into a single RSS feed. Having a feed like that is all I need to enjoy
notifications and reporting straight from the RSS reader, no more code
needed from me.
That's very elegant, I must say. I particularly like the way you can
aggregate the feeds and monitor everything on one screen.
--
Mike Russell
www.curvemeister.com/forum/
Feb 16 '07 #6
On 2007-02-15 10:56:48 -0600, "sergio-p" <se*******@gmail.comsaid:
I had no luck in my google search for this answer.
Does anyone know if it's possible to read the entries in the Windows
Event Log of the server running my PHP page? I'm trying to create an
itranet page that lists errors from the server event log.... I'd
prefer a pure PHP solution, but I'd be happy to try other alternatives
that involve call outs to non-PHP code.

Thanks in advance.
- Sergio
Well if you can find an ms dos command that will export the log into a
..txt or .csv you can do it in PHP. `` quotes are meant for shell
commands or you can also use exec() function for that. All you got to
do in php is parse the file.

Maybe there are 3rd party apps that can export the windows log into an
xml file, than you don't need php at all. Whole bunch of xsl sheets and
you got your rss feed done.

Feb 17 '07 #7
On Feb 16, 10:00 pm, katman <katma...@bk.ruwrote:
Well if you can find an ms dos command that will export the log into a
.txt or .csv you can do it in PHP. `` quotes are meant for shell
commands or you can also use exec() function for that. All you got to
do in php is parse the file.
Nice idea. In XP I can use this command line:
cscript %systemroot%\system32\eventquery.vbs /l APPLICATION /r 10

In W2K3 I think I'd have to use elogdmp.

I still don't know if I can get the actual text of the message
(instead of just title and time stamp), but I'm much closer to the
solution now.

Thanks for all the good input.
- Sergio

Feb 19 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1592
by: Phuff | last post by:
I need to be able to capture events thrown by the Amyuni print driver( a 3rd parter pdf conversion product), and it has specified numbers which I believe I understand to be thw wParam of the print...
2
5433
by: krukinews | last post by:
Hi, I'm trying to write small program that reads events from computer and stores them in SQL database. But I don't know hove to read logs for let's say last 24 hours, one solution is to read...
1
1227
by: Kiosmy | last post by:
I'm doing a chat, if one user close the windows throw X button, I need one event to do an action (delete the user for example) how I can do it. In JavaScript exist onunload event, but it is executed...
0
1080
by: kiosmy | last post by:
I'm doing a chat, if one user close the windows throw X button of the windows, I need one event to do an action (delete the user for example) how I can do it. In JavaScript exist onunload event, but...
0
1219
by: kiosmy | last post by:
I'm doing a chat, if one user close the windows throw X button of the windows, I need one event to do an action (delete the user for example) how I can do it. In JavaScript exist onunload event, but...
4
7833
by: Volker Jobst | last post by:
Hi, Is there an event of windows.forms.form which informs me that the active control will be changed before it will be changed? Something like: Private Sub Form_Validating(ByVal sender As...
0
1636
by: hazz | last post by:
I would like to have control over datagridview events so that when a user 'single clicks' anywhere on the grid, a method call is made to a service and if a user 'double clicks' a Customer detail...
27
4687
by: pisquem | last post by:
I am building an windows service that is to be deployed on a windows server 2003 and I want to have activity written to the event log, I want its own log called ('CustomLog') Below is what I...
0
783
by: pek | last post by:
Is it possible, in any way, to "listen" when a user tries to rename a file in windows explorer? For example, if someone has a file named test.txt in a folder test and tries to rename it to...
0
1392
by: Millardb | last post by:
I used the Configuration and Analysis Tool to configure my Windows 2000 File system. Specifically I set the ACLs for the AppEvent.evt, SecEvent.evt, and SysEvent.evt in c:\winnt\config to:...
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7161
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7539
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3234
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1596
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.