Web server logs with MSSQL
- I often get asked how to deal with web server logs.
- How can they be converted and stored into an SQL database?
- How do we read the web logs, so we can analyze them...
- Microsoft has created this great gem: logparser. Logparser is available for free at Microsoft LogParser.
Logparser
Logparser provides access and convert from/to:
- Text-based data such as log files, XML files and CSV files from Apache or IIS
- Windows Event Log
- Windows Registry
- Exchange logs
- Active Directory logs
LogParser examples
- Microsoft on their technet has a whole bunch of examples see: LogParser examples
Querying data with LogParser
- LogParser.exe -i:NCSA "select logfilename, logrow, remotehostname, remotelogname, username, datetime, request, statuscode, bytessent, referer, user-agent, cookie from \sql\access_log.20070908011201" -o:datagrid

Querying data with LogParser
- LogParser uses SQL syntax for querying the logs.

