SOLVED
Home

Syntax Errors on WAFv2 Log analytics

%3CLINGO-SUB%20id%3D%22lingo-sub-743656%22%20slang%3D%22en-US%22%3ESyntax%20Errors%20on%20WAFv2%20Log%20analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-743656%22%20slang%3D%22en-US%22%3E%3CP%3Etrying%20to%20execute%3A%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3EAzureDiagnostics%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3ECategory%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%E2%80%9C%3C%2FSPAN%3E%3CSPAN%3EApplicationGatewayFirewallLog%3C%2FSPAN%3E%3CSPAN%3E%E2%80%9D%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3Eaction_s%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%E2%80%9C%3C%2FSPAN%3E%3CSPAN%3EBlocked%3C%2FSPAN%3E%3CSPAN%3E%E2%80%9D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%3CSPAN%3Ecount%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3Edetails_message_s%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3CSPAN%3Eby%3C%2FSPAN%3E%3CSPAN%3Edetails_message_s%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3Ebin%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3ETimeGenerated%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E5%3C%2FSPAN%3E%3CSPAN%3Em%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Erender%3C%2FSPAN%3E%3CSPAN%3Ebarchart%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eto%20check%20the%26nbsp%3B%20WafV2%20Fw%20logs%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eand%20get%20a%20syntax%20error%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ei%20get%20the%20same%20when%20i%20try%20to%20do%26nbsp%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EAzureDiagnostics%3CBR%20%2F%3E%7C%20where%20ResouceProvider%20%3D%3D%20%22MICROSOFT.NETWORK%22%20and%20Category%20%3D%3D%20%22ApplicationGatewayFirewalllog%22%3CBR%20%2F%3E%7C%20where%20requestUri_s%20--%20%22%2F%22%20and%20action_s%20%3D%3D%20%22Blocked%22%3CBR%20%2F%3E%7C%20summarize%20count%20()%20by%20ruleID_s%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Ethe%20resource%20provider%20and%20%22action_s%22%20are%20not%20recognized%20for%20some%20reason...%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-743656%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-744133%22%20slang%3D%22en-US%22%3ERe%3A%20Syntax%20Errors%20on%20WAFv2%20Log%20analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-744133%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F373036%22%20target%3D%22_blank%22%3E%40Leon_K%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EI%20do%20not%20have%20those%20logs%20in%20a%20demo%20environment%20but%20executing%20the%20first%20query%20does%20not%20give%20me%20any%20syntax%20errors%20just%200%20records.%20Can%20you%20give%20more%20details%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20second%20query%20you%20have%20posted%20truly%20give%20syntax%20error%20but%20that%20is%20because%20you%20are%20using%20'--'%20instead%20of%20'%3D%3D'%20I%20would%20assume%20for%20filtering%20on%20requestUri_s.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-744640%22%20slang%3D%22en-US%22%3ERe%3A%20Syntax%20Errors%20on%20WAFv2%20Log%20analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-744640%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F373036%22%20target%3D%22_blank%22%3E%40Leon_K%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDo%20you%20have%20those%20logs%3F%3C%2FP%3E%0A%3CPRE%3EAzureDiagnostics%0A%7C%20where%20Category%20startswith%20%22ApplicationGateway%22%20%0A%7C%20summarize%20count()%20by%20Category%20%3C%2FPRE%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fapplication-gateway%2Fapplication-gateway-diagnostics%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fapplication-gateway%2Fapplication-gateway-diagnostics%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-745247%22%20slang%3D%22en-US%22%3ERe%3A%20Syntax%20Errors%20on%20WAFv2%20Log%20analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-745247%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239477%22%20target%3D%22_blank%22%3E%40Clive%20Watson%3C%2FA%3E%26nbsp%3B%20no%20blocked%20logs%20as%20its%26nbsp%3B%20test%20environment%2C%20but%20i%20at%20the%20least%20expect%20it%20to%20show%20)%20logs%20found.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-745255%22%20slang%3D%22en-US%22%3ERe%3A%20Syntax%20Errors%20on%20WAFv2%20Log%20analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-745255%22%20slang%3D%22en-US%22%3Ethats%20strange%2C%20i%20would%20expect%20it%20to%20give%20me%20the%20same%3CBR%20%2F%3Ebut%20all%20i%20get%20is%3A%3CBR%20%2F%3ESYNTAX%20ERROR%3CBR%20%2F%3E%3CBR%20%2F%3ESyntax%20Error%3CBR%20%2F%3E%3CBR%20%2F%3ESupport%20id%3A%204d685e97-a316-4efa-aeab-43110d965800%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20only%20thing%20i%20get%20to%20go%20by%20is%20that%20the%20log%20analytics%20highlights%20the%3CBR%20%2F%3E%E2%80%9CApplicationGatewayFirewallLog%E2%80%9D%20and%20action_s%20%3D%3D%20%E2%80%9CBlocked%E2%80%9D%3CBR%20%2F%3Epart%20as%20bad%20syntax...%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-745286%22%20slang%3D%22en-US%22%3ERe%3A%20Syntax%20Errors%20on%20WAFv2%20Log%20analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-745286%22%20slang%3D%22en-US%22%3Ere%3A%20the%20--%20vs%20%3D%3D%20that%20was%20my%20typo%20posting%20here%2C%20but%20for%20some%20reason%20the%20error%20i%20get%20for%20syntax%20there%20is%20on%20action_s%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EAzureDiagnostics%3CBR%20%2F%3E%7C%20where%20ResourceProvider%20%3D%3D%20%22MICROSOFT.NETWORK%22%20and%20Category%20%3D%3D%20%22ApplicationGatewayFirewalllog%22%3CBR%20%2F%3E%7C%20where%20requestUri_s%20%3D%3D%20%22%2F%22%20and%20action_s%20%3D%3D%20%22Blocked%22%3CBR%20%2F%3E%7C%20summarize%20count%20()%20by%20ruleID_s%3CBR%20%2F%3ESYNTAX%20ERROR%3CBR%20%2F%3E%3CBR%20%2F%3E'where'%20operator%3A%20Failed%20to%20resolve%20column%20or%20scalar%20expression%20named%20'action_s'%3CBR%20%2F%3E%3CBR%20%2F%3ESupport%20id%3A%2026c9911a-d269-4b3e-ab0a-db27405f2f8c%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-745330%22%20slang%3D%22en-US%22%3ERe%3A%20Syntax%20Errors%20on%20WAFv2%20Log%20analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-745330%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F373036%22%20target%3D%22_blank%22%3E%40Leon_K%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3EAzureDiagnostics%0A%7C%20where%20ResourceProvider%20%3D%3D%20%22MICROSOFT.NETWORK%22%20%2F%2Fand%20Category%20%3D%3D%20%22ApplicationGatewayFirewalllog%22%0A%7C%20where%20requestUri_s%20%3D%3D%20%22%2F%22%20and%20action_s%20!%3D%20%22Blocked%22%0A%7C%20summarize%20count%20()%20by%20action_s%2C%20ruleId_s%3C%2FPRE%3E%0A%3CP%3EI%20don't%20have%20that%20data%2C%20nor%20is%20it%20in%20the%20demo%20portal%2C%20but%20%3CSTRONG%3EruleId_s%3C%2FSTRONG%3Eand%20%3CSTRONG%3Eaction_s%3C%2FSTRONG%3Eseem%20to%20work%20in%20this%20test%20query%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fportal.loganalytics.io%2FDemo%3Fq%3DH4sIAAAAAAAAA0WNwQqCQBRF90L%252F8HJVEPkFLswyJMowo6VM48OGRsfezCRKH5%252B6qNWFwz33Br0l3ApW1kobwfXM%252BUD7QEJIUStLHM%252Bk3qJAAt8H9xiHaXJJomx92mW3JD244HmsLiBkBktF3dQKmkYKzoxQ9X7gLesiQUNIKVXp%252Fi8IXxa1uZLI9SR6LoxjjI%252FqwOYD20jFn1hMmrZVxUj0CFzZ2sBiCffuV18BWYlxkWvnC5CtyG7XAAAA%26amp%3Btimespan%3DP7D%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EGo%20to%20Log%20Analytics%20and%20Run%20Query%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-746749%22%20slang%3D%22en-US%22%3ERe%3A%20Syntax%20Errors%20on%20WAFv2%20Log%20analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-746749%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F373036%22%20target%3D%22_blank%22%3E%40Leon_K%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20I%20get%20what%20is%20the%20error%20about.%20Some%20columns%20will%20not%20exist%20if%20there%20was%20no%20data%20for%20them%20at%20any%20point%20in%20time.%20The%20action_s%20column%20will%20appear%20in%20the%20schema%20only%20if%20at%20some%20point%20such%20data%20was%20ingested.%20At%20the%20time%20of%20ingestion%20that%20column%20will%20be%20created%20in%20the%20schema.%20Best%20way%20is%20configure%20your%20App%20GW%20to%20send%20diagnostic%20logs%20to%20Log%20Analytics%20and%20once%20data%20is%20ingested%20for%20that%20log%20the%20column%20would%20appear%20and%20you%20will%20not%20get%20errors.%20Of%20course%20Kusto%20is%20powerful%20language%20so%20you%20can%20do%20other%20things%20like%20if%20column%20do%20not%20exists%20put%20some%20default%20value%20and%20create%20it.%20I%20have%20answered%20that%20question%20here%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FAzure-Log-Analytics%2FGetting-Failed-to-resolve-scalar-expression-How-to-create-column%2Fm-p%2F352954%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FAzure-Log-Analytics%2FGetting-Failed-to-resolve-scalar-expression-How-to-create-column%2Fm-p%2F352954%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20will%20mark%20this%20reply%20as%20answer%20but%20if%20you%20need%20some%20guidance%20on%20diagnostic%20logs%20let%20me%20know.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-747563%22%20slang%3D%22en-US%22%3ERe%3A%20Syntax%20Errors%20on%20WAFv2%20Log%20analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-747563%22%20slang%3D%22en-US%22%3ESo%2C%20it%20does%20not%20exist%20even%20as%20an%20option%20before%20the%20FW%20log%20pushes%20it%3F%20oh%20wow%3CBR%20%2F%3EThanks%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-747655%22%20slang%3D%22en-US%22%3ERe%3A%20Syntax%20Errors%20on%20WAFv2%20Log%20analytics%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-747655%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F373036%22%20target%3D%22_blank%22%3E%40Leon_K%3C%2FA%3EYes%2C%20certain%20columns%20are%20created%20only%20when%20first%20data%20for%20them%20arrives.%20Similar%20the%20way%20it%20is%20with%20custom%20logs%20via%20data%20ingestion%20api.%20Some%20columns%20are%20available%20out%20of%20the%20box%20but%20that%20is%20for%20example%20such%20that%20are%20common%20across%20all%20diagnostic%20logs%20like%20Category.%20The%20current%20schema%20for%20your%20workspace%20can%20be%20seen%20in%20Logs%20view.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Leon_K
Occasional Contributor

trying to execute:

AzureDiagnostics
| where Category == ApplicationGatewayFirewallLog and action_s == Blocked
| summarize count(details_message_s) by details_message_s, bin(TimeGenerated, 5m)
| render barchart
 
to check the  WafV2 Fw logs 
and get a syntax error 
i get the same when i try to do 
 
AzureDiagnostics
| where ResouceProvider == "MICROSOFT.NETWORK" and Category == "ApplicationGatewayFirewalllog"
| where requestUri_s -- "/" and action_s == "Blocked"
| summarize count () by ruleID_s
 
the resource provider and "action_s" are not recognized for some reason...
 
 
 
 
9 Replies

Hi @Leon_K ,

I do not have those logs in a demo environment but executing the first query does not give me any syntax errors just 0 records. Can you give more details?

 

The second query you have posted truly give syntax error but that is because you are using '--' instead of '==' I would assume for filtering on requestUri_s.

@Leon_K 

 

Do you have those logs?

AzureDiagnostics
| where Category startswith "ApplicationGateway" 
| summarize count() by Category 

https://docs.microsoft.com/en-us/azure/application-gateway/application-gateway-diagnostics 

@Clive Watson  no blocked logs as its  test environment, but i at the least expect it to show "0 logs found".

 

 

thats strange, i would expect it to give me the same
but all i get is:
SYNTAX ERROR

Syntax Error

Support id: 4d685e97-a316-4efa-aeab-43110d965800

The only thing i get to go by is that the log analytics highlights the
“ApplicationGatewayFirewallLog” and action_s == “Blocked”
part as bad syntax...
re: the -- vs == that was my typo posting here, but for some reason the error i get for syntax there is on action_s


AzureDiagnostics
| where ResourceProvider == "MICROSOFT.NETWORK" and Category == "ApplicationGatewayFirewalllog"
| where requestUri_s == "/" and action_s == "Blocked"
| summarize count () by ruleID_s
SYNTAX ERROR

'where' operator: Failed to resolve column or scalar expression named 'action_s'

Support id: 26c9911a-d269-4b3e-ab0a-db27405f2f8c

@Leon_K 

 

AzureDiagnostics
| where ResourceProvider == "MICROSOFT.NETWORK" //and Category == "ApplicationGatewayFirewalllog"
| where requestUri_s == "/" and action_s != "Blocked"
| summarize count () by action_s, ruleId_s

I don't have that data, nor is it in the demo portal, but ruleId_s and action_s seem to work in this test query

Go to Log Analytics and Run Query 

 

Solution

Hi@Leon_K 

Now I get what is the error about. Some columns will not exist if there was no data for them at any point in time. The action_s column will appear in the schema only if at some point such data was ingested. At the time of ingestion that column will be created in the schema. Best way is configure your App GW to send diagnostic logs to Log Analytics and once data is ingested for that log the column would appear and you will not get errors. Of course Kusto is powerful language so you can do other things like if column do not exists put some default value and create it. I have answered that question here:

https://techcommunity.microsoft.com/t5/Azure-Log-Analytics/Getting-Failed-to-resolve-scalar-expressi...

 

I will mark this reply as answer but if you need some guidance on diagnostic logs let me know.

So, it does not exist even as an option before the FW log pushes it? oh wow
Thanks

@Leon_K Yes, certain columns are created only when first data for them arrives. Similar the way it is with custom logs via data ingestion api. Some columns are available out of the box but that is for example such that are common across all diagnostic logs like Category. The current schema for your workspace can be seen in Logs view.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies