Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Offtopic sorta: Log Parser to SQL question

Author  Topic 

joblenis
Starting Member

29 Posts

Posted - 2007-04-26 : 15:17:14
This is a question for anyone familiar with log parser. I use log parser to insert the IIS log information into our SQL database. It has been working great but we have now run into 1 problem.

I have been using a SELECT * statement before to put all the IIS log info into a SQL table and it works fine. I want to add 1 extra column to the SQL table though (a primary key). It wont let me use the select * statement anymore because the fields do not match. I even tried specifying the fields one by one but it will not work because there is a different amount of columns now.

What I did was I modified the table already there with a new column (RecordID which is a auto-increment primary key). Can someone please give me advice on how I should persue this? Keep the table with the new design and input the data differently, or somehow specify this new primary key column in the logparser statement.

OLD COMMAND
logparser.exe "SELECT * INTO tblIISLog_NEW FROM \\Hamweb001\LogFiles\W3SVC85298408\*.log" -o:SQL -server:hamdev005 -database:IISLOG_REPORTS -driver:"SQL Server" -createTable:ON -i:IISW3C -iCheckPoint:d:\checkpointweb.lpc>>checkpointweblog.txt



NEW COMMAND I TRIED
logparser.exe "SELECT LogFilename, LogRow, date, time, c-ip, cs-username, s-sitename, s-computername, s-ip, s-port, cs-method, cs-uri-stem, cs-uri-query, sc-status, sc-substatus, sc-win32-status, sc-bytes, cs-bytes, time-taken, cs-version, cs-host, cs(User-Agent), cs(Cookie), cs(Referer), s-event, s-process-type, s-user-time, s-kernel-time, s-page-faults, s-total-procs, s-active-procs, s-stopped-procs INTO tblIISLog_NEW FROM \\Hamweb001\LogFiles\W3SVC85298408\*.log" -o:SQL -server:hamdev005 -database:IISLOG_REPORTS -driver:"SQL Server" -createTable:ON -i:IISW3C -iCheckPoint:d:\checkpointweb.lpc>>checkpointweblog.txt



Errors I get now:

1) Number of columns in table 'tblIISLog_NEW' (33) is different than number of columns in SELECT clause (32)

2) SQL table column "RecordID" data type is not compatible with SELECT clause item "LogFilename" (type STRING)



Thank you

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-04-26 : 16:02:46
try looking here: http://www.logparser.com/


www.elsasoft.org
Go to Top of Page

joblenis
Starting Member

29 Posts

Posted - 2007-04-26 : 16:07:24
ya I posted there too yesterday, no response yet. Thanks thou. It was just a long shot posting this here since im sure quite a few people use log parser to input to SQL.

http://www.logparser.com/instantforum33/shwmessage.aspx?ForumID=2&MessageID=5525&TopicPage=&Post=True&AutoApprove=false
Go to Top of Page
   

- Advertisement -