Importing iis log file to sql server database

  • Hi

    I am importing iis log file in to a table for some reporting purpose. I am doing it manually at the moment.

    Please can anybody let me know any way i can make it automatic so that i can pass logfile name and path to a stored procedure or package to this automatically.

    Thanks

    Sridhar

  • You can pass in the parameters to a stored procedure, use the parameters to build a call to the bcp utility and then use xp_cmdshell to execute the bcp task.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

  • http://www.iisfaq.com/default.aspx?View=A486&P=141 might be of interest to you

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Never see them, but does iss log file have some structure? Are separated in columns?

    If not, can use a DOS command like more with xp_cmdshell to read the file and insert it into a SQL table.

     

    CREATE TABLE #iss_LogFile (Log VARCHAR(8000))

    GO

    INSERT INTO #iss_LogFile

    EXEC master.dbo.xp_cmdshell 'more PathtoFile'

    GO

    SELECT * FROM #iss_Logfile

     

  • Thanks for all replys

    Frank

    Thank you very much for that link. It is very usefull for me.

  •  

    I suggest another solution if you are interrested. If you want import iis log files to sql server database - ok, but when you must import for example 1 GB log files per day I suggest Log Parser 2.0. It's Microsoft tool and the most important thing it's free (I was reading license 6 months ago). You can analyze iis files using sql commands and export aggregates to sql server database via DSN. It's very fast !!, flexible and in my opinion great tool. But of course - your choice.

    Best regards,

    Gregory

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply