How do you search Google App Engine logs in the new Cloud Console using regular expressions?
This blog post suggests you just need to type regex:my.*query
to search, but that does not seem to work in the logging console. When I do that, it auto-corrects to the following query text:regex:my.*query
.
Although, I am late here but you can do it in stackdriver.
= # equal
!= # not equal
> < >= <= # numeric ordering
: # "has" matches any substring in the log entry field
In case, you want to find all GET response with 500 in textPayload
, you need to add in filters:
textPayload:"500"
To search all zone
with central1
in it:
resource.labels.zone:"-central1-"
That's it. You can refer this link for more advance filters
The Stackdriver Logging product does not currently support regular expressions. It was originally supported a while back (as you saw in the blog post), but we found that it was rarely used and that many of those uses were for simple patterns that had simpler solutions without the performance and other penalties of regexes.
In basic filter mode (the default), text searches automatically are case-insensitive and match substrings of field values, and you can use ".." to represent numerical ranges. In advanced filter mode, the "has" operator accomplishes the same thing through using a :
instead of an =
in your filter expression, e.g. path.to.field: "value"
. (See also: Write effective advanced filters)
If these operators don't accomplish your goal, consider filing feedback through the speech bubble button in the top right of the Cloud Console providing details of your use case and what you're ultimately trying to accomplish, and we'll incorporate that feedback as we plan the future direction of the product.
Nowadays Google Cloud Operations Logging has support for regular expressions. This feature was published on 2020-09-17, see https://cloud.google.com/blog/products/management-tools/cloud-logging-gets-regular-expression-support. You regex works in this format:
textPayload=~"my.*query"
You can query regular expression matches with operator =~
and non-matches with operator !~
:
=~ # regular expression search for a pattern
!~ # regular expression search not for a pattern
More info on syntax and examples can be found in the Google Cloud Operations Suite Logging query language reference: https://cloud.google.com/logging/docs/view/logging-query-language#regular-expressions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With