4

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!

speedplane
  • 15,673
  • 16
  • 86
  • 138

2 Answers2

4

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"
Jeff Deskins
  • 1,650
  • 1
  • 10
  • 9
  • 1
    I did't see any docs for latency filter under advanced search. However, you can Ctrl-Space to see list of available fields for creating a filter. – Jeff Deskins Feb 02 '16 at 14:54
  • Latency is one of the few metrics in Cloud Logging that requires a unit (s in this example, but other SI time units also work) – Craig Finch Jul 29 '21 at 19:47
0

Do you mean latency? Something like this should works

protoPayload.latency > 3s
marcadian
  • 2,608
  • 13
  • 20