Question

I am trying to run LogParser to dump all contents from access.log into an equivalent CSV file:

C:\Program Files\Log Parser 2.2>LogParser "select * into foo.csv from C:\Program  Files\Apache Software Foundation\Apache2.2\logs\access.log" -i:ncsa -o:csv

However, I keep getting this error: Error: Syntax Error: extra token(s) after query: 'Files\Apache' and I am unsure of whether I am missing more syntax or I have some format wrong.

Was it helpful?

Solution

Add single quotes around the source log file (if the path has any empty spaces in it).

LogParser "select * into foo.csv from 'C:\Program Files\Apache Software Foundation\Apache2.2\logs\access.log'" -i:ncsa -o:csv

OTHER TIPS

I'm not familiar with log parser, but judging from the error, your query is terminating at the first space.
The site: http://misigah.com/?p=28 mentions using "\u0020" for spaces within a query column. Following that guidance, your query would be:

*LogParser "select * into foo.csv from C:\Program\u0020Files\Apache\u0020Software\u0020Found...*

There is also 2 spaces between "Program" and "Files".

Hope that helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top