azurekibanaazure-data-explorer

Kibana Query for Message that contains ":"


I have the following documents in Kibana

document1: LogStatus ApplicationA:X ApplicationB:O ApplicationC:O
document2: LogStatus ApplicationA:O ApplicationB:O ApplicationC:O
document3: LogStatus ApplicationD:O ApplicationE:O ApplicationF:O

Note: X means stopped, O means running

I wanted to search for documents that contains message LogStatus and :X. For example above, I want to get document1.

I tried this query: message:*LogStatus* and message: *:X*

However, since ":" is special character in KQL as equals, it returns error.

Any idea how to search message that contains ":"?


Solution

  • Converting my comment into an answer. Here, : is a special character. As you did the search with a special character, you got the above error. To search a string which is involving a special character, you need to escape it.

    You can use \ as an escape character here to escape the special character : in your string.

    Modify the query like below to search for LogStatus and :X.

    message:*LogStatus* and message:*\:X*
    

    Now, it will escape the : and will search for the required :X string in each document.

    Sample demo:

    Here, you can see it escaped the : in the below query and got the expected results.

    container.image.name : *confluentinc/cp-kafka\:5.0.1*
    

    enter image description here