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

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!

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.