IIS 7 & IIS 8
Last post Mar 30, 2012 07:56 AM by fab777
Mar 29, 2012 04:50 AM|LINK
I need some help in understanding IIS7 Log Files
1. I want to read date, IP address, URL + Parameters and insert them into database
2. What are the columns I should look for in the log files
3. There are several web sites running of IIS7 (web server) but I want to able to extract IIS Log Information for the selected sites only.
Any useful links/ code example will be greatly appreciated.
Many thanks for your help in advance.
Mar 29, 2012 08:02 AM|LINK
1. you need these fields :
date > 'date' (don't you want time? If yes, the fiel is 'time')
IP address > c-ip if you want the user IP addressotherwise it's 's-ip', but I assumed you know this one...
URL + Parameters > 'cs-uri-stem' and 'cs-uri-query'
3. Each website have an ID, this ID is used to name the logdirectory, so it's pretty easy to get the right logfiles by a script, parse the log file and get the wanted fields, and then insert into your database.
Maybe LogParser will be usefull for your need :
Mar 29, 2012 07:38 PM|LINK
Hi fab777, I tell you what...... you are a legend mate, thanks so much for your help,
One last question, in my C:\inetpub\logs\LogFiles there are several log file example
W3SVC1 , W3SVC2 my question is how often these files are created and when we use the Log Parser does it query all the log files in C:\inetpub\logs\LogFiles
What I want to achive is to read all the required data from the log files and then insert them in the database, and then delete the log file.
Again many thanks for pointing me in the right direction.
Mar 30, 2012 07:56 AM|LINK
I tell you what...... you are a legend mate, thanks so much for your help
By default, the logfiles are daily "rotated", and you can identify them by name, logfiles are named with the date like for today 'ex120330.log'
I didn't understand rightly your need. If you don't want to keep the logfiles and just import the data in database, after importing the data from the old files, maybe the solution will be 'ODBC logging'.
Here's some reading about his: