Home arrow ASP arrow Page 2 - View Your Web Servers Log Files With ASP

View Your Web Servers Log Files With ASP

Mike knows the pain and frustration of having a web server crash unexpectedly... it happens when we least expect it. In this article, he's going to describe a simple way to create an ASP page that will allow us to view our web servers log files in a standard web page across the Internet.

Author Info:
Rating: 5 stars5 stars5 stars5 stars5 stars / 57
December 28, 2001
  1. · View Your Web Servers Log Files With ASP
  2. · Windows 2000 and log files
  3. · The MSWC logging utility
  4. · The ShowLogEntries sub-routine
  5. · Conclusion

print this article

View Your Web Servers Log Files With ASP - Windows 2000 and log files
(Page 2 of 5 )

Whenever an error occurs either directly or in-directly through IIS, or whenever a file is retrieved from the web server, the details of that activity are stored in a log file. All IIS log files are stored in the c:\winnt\system32\w3svc1 directory. A new log file is created for each new day, and the names of these log files are sequential: ex010828.log, ex010829.log, etc. To get a better understanding of what an IIS web server log file looks like, fire up notepad and open any of the files in your web servers “c:\winnt\system32\w3svc1” directory. It should resemble the one shown below:

One of the log files on the devArticles.com development server

This is one of the log files sitting on the development server for devArticles.com. Our site is developed and tested using IIS and PHP on a Windows 200 server, and then deployed to our production server. Our production server runs Apache, PHP and MySQL on several Linux servers.

If you take a look at the log file, then you will notice it contains several rows of values. Each value is separated by a space and contains the details of that individual log entry. A log entry from the file shown above looks like this:

2001-08-25 00:21:34 - 80 POST /devarticles/devadmin/index.php - 200 Mozilla/4.0+(compatible;+MSIE+5.5;+Windows+NT+5.0;+COM++1.0.2204)

At the top of each Windows 2000 log file, there is a commented line (comments in a log file begin with “#”), which describes each of the fields in a log entry:

#Fields: date time c-ip cs-username s-ip s-port cs-method cs-uri-stem cs-uri-query sc-status cs(User-Agent)

So, in the sample log entry above, the first “field” is the date. The second is the time, third is the clients IP address, etc. Log files can contain just a couple of entries, or can contain thousands… it all depends on how much activity went on during any particular day for that server.

Now that we understand a bit more about how and where Windows 2000 server stores its IIS web logs, let’s look at how we can gain access to them through as ASP Script.
blog comments powered by Disqus

- Central Scoreboard with Flash and ASP
- Calorie Counter Using WAP and ASP
- Creating PGP-Encrypted E-Mails Using ASP
- Be My Guest in ASP
- Session Replacement in ASP
- Securing ASP Data Access Credentials Using t...
- The Not So Ordinary Address Book
- Adding and Displaying Data Easily via ASP an...
- Sending Email From a Form in ASP
- Adding Member Services in ASP
- Removing Unconfirmed Members
- Trapping HTTP 500.100 - Internal Server Error
- So Many Rows, So Little Time! - Case Study
- XDO: An XML Engine Class for Classic ASP
- Credit Card Fraud Prevention Using ASP and C...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials