I am writing the below code in KQL :-
UserBaseTable
| where RawData contains_cs "REF "
I want the records which start with the string REF but when I run the above command I get records where in the "REF" string is coming in between also. I tried using the contains_cs also but it only works with the case sentivity not with the position of the searchable string. How do I get the desired result
Also the or operator doesnt work for me in KQL. Do we have a different usage of the "OR" operator?
2
Answers
Have a look at startswith_cs it could do what you’re needing.
Wordlist courtesy of The Free Dictionary.
My output:
|R|
|-|
|REFlected|
|REFLECTS|
|REF erence|
You can use the startswith_cs operator in KQL to get the records that start with the string "REF". Here is the code:
This will return only the records where the "REF" string is at the beginning of the RawData field.
demo
Reference: The case-sensitive startswith string operator – Azure Data Explorer – Microsoft document