'Cloud Logging Advanced Log Filters: Find HTTP Requests >= Duration
Google's Advanced Cloud Logging Filters seem incredibly powerful, but equally complex to use. How does one craft a logging query that finds all HTTP requests with a duration longer than 3 seconds, which also contains the text foo bar
?
I've read through the documentation, but it leaves a bit to be desired (it seems directed towards language authors, not users of the system). I know there is a field for Duration, but does anyone have an example on how to use it?
Update 4/2022: The documentation has gotten a lot better since writing this, take a look!
Solution 1:[1]
To filter logs by duration and text ("foo bar") for the default App Engine instance, you can run the following under advanced filter:
metadata.serviceName="appengine.googleapis.com"
metadata.labels."appengine.googleapis.com/module_id"="default"
log="appengine.googleapis.com/request_log"
protoPayload.latency > 3s
"foo bar"
Solution 2:[2]
Do you mean latency? Something like this should works
protoPayload.latency > 3s
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jeff Deskins |
Solution 2 | marcadian |