I am trying to determine if a user downloaded a file from FTP using MS Log Parser 2.2
I have not been able to get parser SQL query going, although I have used several samples queries.
Water Down Parser Query does not work:
strSQL = "SELECT date,COUNT(*) AS downloads,c-ip "
strSQL = strSQL & "FROM C:\temp\Log\*.log "
strSQL = strSQL & "WHERE cs-method='RETR' "
strSQL = strSQL & "GROUP BY date,c-ip "
Error:
RecordSet cannot be used at this time [Unknown Error]
Question:
How do I create a query:
- SELECT Date and Time of download
- Where user = 'xxx'
- WHERE RETR = is a download
- WHERE Filename = u_ex150709.log or xxx
Answers in C# are also welcome
VB.net Code:
Dim rsLP As ILogRecordset = Nothing
Dim rowLP As ILogRecord = Nothing
Dim LogParser As LogQueryClassClass = Nothing
Dim W3Clog As COMW3CInputContextClassClass = Nothing
Dim UsedBW As Double = 0
Dim Unitsprocessed As Integer
Dim strSQL As String = Nothing
LogParser = New LogQueryClassClass()
W3Clog = New COMW3CInputContextClassClass()
Try
strSQL = "SELECT date,COUNT(*) AS downloads,c-ip "
strSQL = strSQL & "FROM C:\temp\Log\*.log "
strSQL = strSQL & "WHERE cs-method='RETR' "
strSQL = strSQL & "GROUP BY date,c-ip "
'run the query against W3C log
rsLP = LogParser.Execute(strSQL, W3Clog)
'Error occurs in the line below
rowLP = rsLP.getRecord()
rsLP.atEnd()
before calling the last line ? – Kent