Reputation: 131
Error parsing query: The specified FROM-ENTITY "<1>" is invalid [The filename, directory name, or volume label syntax is incorrect.]
<1>
is working when use in sql in Log Parser 2.2, the folder is exist.
Query is working if i following article - LogParser DataProvider for ADO.NE
try
{
ILogRecord rowLP = null;
ILogRecordset rsLP = null;
LogQueryClass logQuery = new LogQueryClass();
COMW3CInputContextClass comW3CInputContext = new COMW3CInputContextClass();
string strSQL = @"SELECT " +
@"COUNT(*) AS [Requests], " +
@"DIV(DIV(SUM(cs-bytes), 1024), 1024) AS [MBytes received], " +
@"DIV(DIV(SUM(sc-bytes), 1024), 1024) AS [MBytes sent], " +
@"c-ip AS [IP Address], cs(User-Agent) AS [User agent], " +
@"MAX(date) AS [Last visit] " +
@"FROM <1> " +
@"GROUP BY [IP Address], [User agent] " +
@"ORDER BY [Requests] DESC";
// run the query against W3C log
rsLP = logQuery.Execute(strSQL, comW3CInputContext);
rowLP = rsLP.getRecord();
}
catch (System.Runtime.InteropServices.COMException exc)
{
Console.WriteLine("Unexpected error: " + exc.Message);
}
Upvotes: 0
Views: 1543
Reputation: 1579
The <1> "magic shortcut" only works with the IISW3C input format, which is the format that parses the W3C log files generated by IIS. In your code, you are using the W3C input format, which parses generic W3C-formatted logs and thus knows nothing about <1>.
Upvotes: 1
Reputation: 131
I found they is not working by follow this http://www.codeproject.com/Articles/13504/Simple-log-parsing-using-MS-Log-Parser-2-2-in-C-NE which is the line
COMW3CInputContextClass comW3CInputContext = new COMW3CInputContextClass();
rsLP = logQuery.Execute(strSQL, comW3CInputContext);
By make change as below than the query can be work
rsLP = logQuery.Execute(strSQL, null);
Upvotes: 0