Select data fields for your IIS Log file
After reading my earlier articles “LOG Parser – Wonderful yet under-appreciated tool to read log of windows, IIS” and “Read IIS log with LOG Parser in SQL-Like language” one of the blog reader sent me an email and asked me that if he runs “Command 2” and “Command 3” given in “Read IIS log with LOG Parser in SQL-Like language” article, he face the error something like this:
Error: SELECT clause: Syntax Error: unknown field ‘time-taken’.
The closest match for input format ‘W3C’ is ‘time’.
To see valid fields for the W3C input format type:
LogParser -h -i:W3C
He has provided me the screen shot which looks something like this:
He asked me whether I have made mistake or typo in providing the queries in “Read IIS log with LOG Parser in SQL-Like language”.
Well, I would like to say that there is no mistake/type/error in the commands provided. If your log file doesn’t have “time-taken” or “cs-bytes” or any other fields, please select the setting of your log file from IIS. You can select/de-select fields from IIS, follow the steps given below to do the same:
1.) Double click on “IIS Logging” from the property of website in IIS.
2.) Click on “Select Fields” button
3.) Select the fields you wanted to include in log file of IIS and click on “OK” button.
Once you have proper field selected, new log file will be generated from the next schedule with the latest fields and the query given in “Read IIS log with LOG Parser in SQL-Like language” will work fine.
Reference: Ritesh Shah
Note: Microsoft Books online is a default reference of all articles.