Advanced Logs Queries with Google Cloud Logs Viewer

Posted on April 13, 2020 at 10:19 pm

With Google Cloud Logs Viewer you can perform advanced logs queries to search, for example, all Load Balancer requests that returned a status code different from 200 (useful to spot connection errors) or you can search all requests where the URL contains a specific string.

The official documentation is here:

https://cloud.google.com/logging/docs/view/advanced-queries

Available search operators:

=           # equal
!=          # not equal
> < >= <=   # numeric ordering
:           # "has" matches any substring in the log entry field

Here are some common search examples:

Show requests where requestUrl contains “abc.com”:

resource.type="http_load_balancer"
httpRequest.requestUrl:"abc.com"
httpRequest.status=200

Show requests where status is different from 200:

resource.type="http_load_balancer"
httpRequest.status!=200

Receive updates via email

Other Posts

Updated Posts