Search code examples
google-app-enginegoogle-cloud-stackdriver

In StackDriver logging viewer is there a way to query for entries that DO NOT contain a specific string


My question is wrt to the log viewer at https://console.cloud.google.com/logs/viewer All the examples here show how to search for existence of text but not for absence.

I want to use this functionality to search for errors that do not contain "Request was aborted after waiting too long to attempt to service your request."


Solution

  • You can use Advanced Logs Filters which support the NOT boolean operator:

    Boolean expressions

    expression =
        ["NOT" | "-"] comparison {["AND" | "OR"] ["NOT" | "-"] comparison}
    

    From Introduction:

    To use advanced filters in the Logs Viewer, select the drop-down menu at the end of the search bar, and choose Convert to advanced filter. You see the advanced filter interface pictured below:

    enter image description here

    In your case add the following line to the ones filled in by default when switching to the advanced filter:

    NOT "Request was aborted after waiting too long to attempt to service your request."