Question IIS Log Query to Match Azure Application Insights ?

Mar 23, 2023
1
0
10
Azure Application Insights query to a query for a local IIS log file using IIS Log Parser.
Kusto Query for AppInsights:
requests
| where timestamp between(todatetime('2019-05-06T15:15:00.000')..todatetime('2019-05-06T15:22:00.000'))
| order by timestamp desc
| summarize count() by url
| order by count_

IIS Log Query Code:
SELECT cs-uri-stem as Url,
FROM 'C:\users\xxxx\Documents\u_ex'
WHERE to_time(time)
BETWEEN TIMESTAMP ('15:15:00','hh🇲🇲ss') AND TIMESTAMP('15:22:00','hh🇲🇲ss')
AND DATE = '2019-05-06'
COUNT(*) As Hits
GROUP BY cs-uri-stem
ORDER By Hits DESC

Error I get in IIS query:
Error parsing query: Syntax Error: : expecting FROM keyword instead of token C:\users\xxxx\Docments\u+ex190506.log" [SQL query syntax invalid or unsupported.]
 

Ralston18

Titan
Moderator
Is the FROM targeting some listing of log files?

Out of curiosity I googled a bit and came to the conclusion that the FROM statement is not what I would expect.

Perhaps the full/correct syntax should be something like:

FROM 'C:\users\xxxx\Documents\u_ex*.log'

With the asterick being a wild card.....

I also noticed that the Error message referenced \Docments\ [My underline.]

Your code shows "FROM 'C:\users\xxxx\Documents\u_ex'

Documents is not mispelled in your posted code.

Take a look at the code actually being run. Verify how documents is spelled.

The error also indicates "u+ex" (underscore special character versus plus sign special character) . Confirm the allowed uses of special characters.

Just observations from afar.