Skip to main content

Check for hits against google cloud logging

Project description

gcp-log-hit-checker

PyPI version Python versions PyPI downloads

Checks a list of GCP Cloud Logging filter patterns and reports whether each had any hits in a configurable time window. Patterns are checked in parallel, progress is shown on stderr, and results are written to stdout.

Installation

uv tool install gcp-log-hit-checker

Or with pip:

pip install gcp-log-hit-checker

Usage

gcp-log-hit-checker <patterns-file> [--project <gcp-project-id>] [--since <duration>] [--format tsv|json] [--timeout <seconds>]
  • --project — GCP project ID, defaults to your active gcloud config project
  • --since — how far back to search; accepts m (minutes), h (hours), d (days), w (weeks). Default: 30d
  • --format — output format, tsv (default) or json
  • --timeout — timeout per pattern check in seconds. Default: 600

Patterns file

One Cloud Logging filter per line. Lines starting with # are ignored.

# Check specific endpoints
httpRequest.requestUrl=~"api/v1/.*/orders"
severity=ERROR resource.type="gce_instance"

Output

Progress and status messages are written to stderr. Results are written to stdout, making it safe to redirect to a file:

gcp-log-hit-checker patterns.txt > results.tsv
gcp-log-hit-checker --format json patterns.txt > results.json

TSV

Tab-separated columns: <emoji>\t<pattern>\t<last-hit-timestamp>\t<entry-link>\t<filter-link>

✅	httpRequest.requestUrl=~"api/v1/.*/orders"	2026-01-15 10:23:45+00:00	https://console.cloud.google.com/...	https://console.cloud.google.com/...
❌	severity=ERROR resource.type="gce_instance"			https://console.cloud.google.com/...

JSON

[
  {
    "pattern": "httpRequest.requestUrl=~\"api/v1/.*/orders\"",
    "status": "hit",
    "timestamp": "2026-01-15 10:23:45+00:00",
    "entry_link": "https://console.cloud.google.com/logs/query;query=insertId%3D%22abc123%22?project=my-project",
    "filter_link": "https://console.cloud.google.com/logs/query;query=...;duration=P30D?project=my-project"
  },
  {
    "pattern": "severity=ERROR resource.type=\"gce_instance\"",
    "status": "no_hit",
    "timestamp": null,
    "entry_link": null,
    "filter_link": "https://console.cloud.google.com/logs/query;query=...;duration=P30D?project=my-project"
  }
]

Possible status values: hit, no_hit, error, cancelled (interrupted before check ran).

Ctrl+C prints a partial summary of completed checks before exiting.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcp_log_hit_checker-0.1.4.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gcp_log_hit_checker-0.1.4-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file gcp_log_hit_checker-0.1.4.tar.gz.

File metadata

  • Download URL: gcp_log_hit_checker-0.1.4.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gcp_log_hit_checker-0.1.4.tar.gz
Algorithm Hash digest
SHA256 92979c997650fc9421ab64c2ec60e69274f10e19d66e3e2e849e2e3b3642a8f0
MD5 96a1f9bcbd2a959d413a655f8b57c41a
BLAKE2b-256 46c424a85f76681443bbe758f4a4dc04c8b09241ed4f0f0f3e68a381051c6746

See more details on using hashes here.

File details

Details for the file gcp_log_hit_checker-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: gcp_log_hit_checker-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gcp_log_hit_checker-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cf42a3e8107272dec7e4d005fe04ac18d83e52f54e06855d5b51231e87bb99b4
MD5 14aac00885ca6e4fe6d6ad6d2fc652c9
BLAKE2b-256 72e7297ba4c2b606473ac6ed31752a91e15f62a59af82a3813fdd374826a0740

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page