Home

Verbatim string with single slash in query (@'\')

%3CLINGO-SUB%20id%3D%22lingo-sub-297959%22%20slang%3D%22en-US%22%3EVerbatim%20string%20with%20single%20slash%20in%20query%20(%40'%5C')%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-297959%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20am%20trying%20to%20work%20with%20a%20verbatim%20string%20which%20contains%20a%20single%20slash%20-%20%40'%5C'%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20seems%20that%20Log%20Analytics%20has%20a%20bug%20validating%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20am%20using%20the%20following%20query%3A%3C%2FP%3E%0A%3CPRE%3Eprint%20%40'%5C'%3C%2FPRE%3E%0A%3CP%3E1.%20In%20Kusto%20it%20works%20as%20expected%20in%20prints%20a%20single%20slash%3C%2FP%3E%0A%3CP%3E2.%20In%20Log%20Analytics%20I%20get%20a%20message%20-%20Syntax%20Error%3C%2FP%3E%0A%3CP%3E3.%20Opening%20log%20analytics%20logs%20blade%20with%20pre-populated%20query%20-%20the%20query%20prints%20a%20single%20slash%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%26nbsp%3B%20Trying%20to%20run%20it%20again%26nbsp%3B%3CSPAN%3E%20-%20Syntax%20Error%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20it%20seems%20to%20me%20that%20the%20engine%20works%20with%20this%20string%20correctly%2C%20but%20the%20validation%20in%20the%20UI%20is%20wrong.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAny%20suggestion%20how%20to%20over%20come%20it%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3EIgal%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-297959%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-298148%22%20slang%3D%22en-US%22%3ERe%3A%20Verbatim%20string%20with%20single%20slash%20in%20query%20(%40'%5C')%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-298148%22%20slang%3D%22en-US%22%3E%3CP%3EMy%20scenario%20is%20quite%20simple.%20I%20have%20several%20queries%20that%20filter%20some%20logs%20which%20contain%20filenames.%3C%2FP%3E%0A%3CP%3EA%20common%20action%20is%20to%20split%20the%20filename%20by%20a%20slash.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20can%20use%20'%5C%5C'%20and%20that%20what%20we%20currently%20do.%20The%20annoying%20part%20is%20that%20those%20queries%20are%20stored%20inside%20a%20json%20file%20which%20requires%20additional%20escaping.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20we%20want%20to%20split%20by%20a%20single%20slash%20and%20have%20to%20write%204%20slashes.%20This%20works%2C%20but%20a%20bit%20confusing.%20So%20I%20am%20trying%20to%20reduce%20the%20number%20of%20escapes%20required.%20And%20I%20thought%20to%20use%20verbatim%20string.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-298140%22%20slang%3D%22en-US%22%3ERe%3A%20Verbatim%20string%20with%20single%20slash%20in%20query%20(%40'%5C')%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-298140%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3EFrom%20your%20question%20it%20is%20not%20clear%20what%20you%20are%20trying%20to%20achieve%20but%20may%20be%20this%20is%20workaround%20for%20you%3F%3C%2FP%3E%0A%3CPRE%3Eprint%20'%5C%5C'%3C%2FPRE%3E%0A%3CP%3EThis%20will%20produce%20single%20slash.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-297964%22%20slang%3D%22en-US%22%3ERe%3A%20Verbatim%20string%20with%20single%20slash%20in%20query%20(%40'%5C')%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-297964%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3EI%20see%20that%20behavior%20as%20well..%20checking%20why%20it's%20so%2C%20and%20will%20get%20back%20to%20you%20soon.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%20for%20reporting!%3C%2FP%3E%3C%2FLINGO-BODY%3E
igshapir
Microsoft

Hi All,

 

I am trying to work with a verbatim string which contains a single slash - @'\'

 

It seems that Log Analytics has a bug validating it.

 

I am using the following query:

print @'\'

1. In Kusto it works as expected in prints a single slash

2. In Log Analytics I get a message - Syntax Error

3. Opening log analytics logs blade with pre-populated query - the query prints a single slash

    Trying to run it again  - Syntax Error

 

So it seems to me that the engine works with this string correctly, but the validation in the UI is wrong.

 

Any suggestion how to over come it?

 

 

Regards,

Igal

3 Replies

Hi,

I see that behavior as well.. checking why it's so, and will get back to you soon.

 

Thanks for reporting!

Highlighted

Hi,

From your question it is not clear what you are trying to achieve but may be this is workaround for you?

print '\\'

This will produce single slash.

My scenario is quite simple. I have several queries that filter some logs which contain filenames.

A common action is to split the filename by a slash.

 

 

I can use '\\' and that what we currently do. The annoying part is that those queries are stored inside a json file which requires additional escaping.

 

So we want to split by a single slash and have to write 4 slashes. This works, but a bit confusing. So I am trying to reduce the number of escapes required. And I thought to use verbatim string.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 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
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies