Skip to content

feat: add optional filtering parameters to get_service_log tool#212

Open
josewweee wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
josewweee:feat/log-filtering-options
Open

feat: add optional filtering parameters to get_service_log tool#212
josewweee wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
josewweee:feat/log-filtering-options

Conversation

@josewweee

Copy link
Copy Markdown

Summary

Add optional filtering parameters to get_service_log tool to help reduce API quota usage when fetching Cloud Run logs.

New Parameters

Parameter Type Description
severity enum Minimum log level (DEFAULT, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY)
freshnessMinutes number Only fetch logs from the last N minutes
textFilter string Regex match on textPayload
limit number Entries per page (default: 100, max: 1000)
maxPages number Limit number of API requests/pages

Motivation

The current implementation fetches all logs without any filtering, which can quickly exhaust the Cloud Logging API quota ("Read requests per minute"). These optional parameters allow users to narrow down results and reduce API usage.

Backward Compatibility

All new parameters are optional. Default behavior remains unchanged - without any filters, the tool fetches all available logs as before.

Testing

  • Unit tests pass
  • Tested against real Cloud Logging API with various filter combinations

@google-cla

google-cla Bot commented Jan 27, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Add support for filtering Cloud Run logs by:
- severity: minimum log level (DEFAULT, INFO, WARNING, ERROR, etc.)
- freshnessMinutes: only fetch logs from the last N minutes
- textFilter: regex match on textPayload
- limit: entries per page (max 1000)
- maxPages: limit number of API requests

These filters help reduce API quota usage when fetching logs.
All parameters are optional - default behavior remains unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant