How make a filter "does not contain" in Google Stackdriver logs

suikoy picture suikoy · Dec 6, 2017 · Viewed 10.6k times · Source

In Google Stackdriver advanced filter I can insert something like:

resource.type="container"
resource.labels.cluster_name="mycluster"
textPayload!="Metric stackdriver_sink_successfully_sent_entry_count was not found in the cache."
severity="INFO"
textPayload:(helloworld)

The last rule means that the field textPayload should contain the string helloworld. But I'm not able to find a way to add a NOT operator.

I would use something like:

textPayload:!(helloworld)

but doesn't work

Answer

suikoy picture suikoy · Dec 6, 2017

just add AND NOT between two rows:

resource.type="container"
resource.labels.cluster_name="mycluster"
textPayload!="Metric stackdriver_sink_successfully_sent_entry_count was not found in the cache."
severity="INFO" AND NOT
textPayload:(helloworld)