Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

how do I configure IIS to post logs to sql server?

How want to save ANY log to my site. the site has a lot of views and the data can be big in a very small time. In addition, I want to show analytics of the use, in real time, and for all the time.

  • Is it make sense to save all the logs in sql-server?

  • What is the pros and cons taking this approach have?

  • what other solution can I have?

share|improve this question
up vote 4 down vote accepted

Microsoft has courteously created an entire KB article called "How To Use SQL Server to Analyze Web Logs" which should answer your title question.

Yes it makes sense to store the logs in sql server if for no other reason than mitigating file corruption issues and also making backups of those files easier using SQL scheduler. The pros of using a SQL Server database are virtually self evident. Flat text files offer no data mining ability. Relational databases that can be queried via SQL are made for information storage and retrieval. That information can easily be culled for trends, statistics, correlations and etc. It's all a matter of developing the queries and reports.

What other solution? Possible using Splunk to gather information from the flat files, but that's not the same. That's not statistics in quite the same way.

share|improve this answer
Is it make sense to store this information forever? I mean this table going to be big... – stacker May 16 '10 at 7:41
@stacker "Big" is relative. As long as you have the hard drive space, SQL Sever can handle it. Tables of tens f millions of rows are nothing for the database engine. Of course, performance while parsing or mining that daa is another story. You could implement table paritioning or once in a while split the data by month or year ino its own table. Personally, if I had the space I'd keep the data around for at least three years for trending purposes, bu I'm a bit of a data packrat. – Wesley May 16 '10 at 18:58

Do not do it - it introduces another hugh system into something as simple as writing log files. Resetting the SQL Server interrupts the logging process.

What I Do is:

  • Logfiles onto a disc
  • Regular load scripts loading them into sql server. On an error, they just get reloaded after an hour with the next attempt ;)
share|improve this answer
The log files go any way to sql-server... so why shouldn't they go there on the beginning? – stacker May 16 '10 at 7:40
Good point about restarting the SQL Server interrupting the logging process. What do you use for loading scripts? An SSIS package? – Wesley May 16 '10 at 19:01

Also see MS LogParser for loading IIS log FILES into SQL Server. e.g.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.