Skip to content

Instantly share code, notes, and snippets.

@jeanbza
Created October 1, 2019 14:17
Show Gist options
  • Save jeanbza/9293a2f74f0509c8dd32ba3d8e80ae09 to your computer and use it in GitHub Desktop.
Save jeanbza/9293a2f74f0509c8dd32ba3d8e80ae09 to your computer and use it in GitHub Desktop.
package main
import (
"context"
"fmt"
"cloud.google.com/go/logging/logadmin"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
c, err := logadmin.NewClient(ctx, "projects/deklerk-sandbox")
if err != nil {
panic(err)
}
filter := `resource.type = "cloud_run_revision"
resource.labels.location = "us-central1"
logName: "run.googleapis.com%2Frequests"
`
it := c.Entries(ctx, logadmin.Filter(filter))
for e, err := it.Next(); err != iterator.Done; {
if err != nil {
panic(err)
}
_ = e
}
fmt.Println("done")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment