Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have to do something similar with Exchange logs. I have yet to find an easier solution utilizing an all SSIS solution. Having said that, here is what I do:</p> <p>First I use logparser from Microsoft and the bulk copy functionality of sql2005</p> <p>I copy the log files to a directory that I can work with them in.</p> <p>I created a sql file that will parse the logs. It looks similar to this:</p> <pre><code>SELECT TO_Timestamp(REPLACE_STR(STRCAT(STRCAT(date,' '), time),' GMT',''),'yyyy-M-d h:m:s') as DateTime, [client-ip], [Client-hostname], [Partner-name], [Server-hostname], [server-IP], [Recipient-Address], [Event-ID], [MSGID], [Priority], [Recipient-Report-Status], [total-bytes], [Number-Recipients], TO_Timestamp(REPLACE_STR([Origination-time], ' GMT',''),'yyyy-M-d h:m:s') as [Origination Time], Encryption, [service-Version], [Linked-MSGID], [Message-Subject], [Sender-Address] INTO '%outfile%' FROM '%infile%' WHERE [Event-ID] IN (1027;1028) </code></pre> <p>I then run the previous sql with logparser:</p> <pre><code>logparser.exe file:c:\exchange\info\name_of_file_goes_here.sql?infile=c:\exchange\info\logs\*.log+outfile=c:\exchange\info\logs\name_of_file_goes_here.bcp -i:W3C -o:TSV </code></pre> <p>Which outputs a bcp file.</p> <p>Then I bulk copy that bcp file into a premade database table in SQL server with this command:</p> <pre><code>bcp databasename.dbo.table in c:\exchange\info\logs\name_of_file_goes_here.bcp -c -t"\t" -T -F 2 -S server\instance -U userid -P password </code></pre> <p>Then I run queries against the table. If you can figure out how to automate this with SSIS, I'd be glad to hear what you did.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload