Skip to content
Agentmart
Submit a tool

gcp-logs

Query GCP Cloud Logging for errors, service logs, and request traces.

Skill by eveld

IndexedMIT★ 10
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/eveld-gcp-logs

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Query GCP Cloud Logging for errors, service logs, and request traces. Use when investigating GCP-hosted services.

Use cases: cloud

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/gcp-logs

What's inside

Skill name
gcp-logs
Description
Query GCP Cloud Logging for errors, service logs, and request traces. Use when investigating GCP-hosted services.
License
MIT
Instructions
120 lines in SKILL.md · view on GitHub

Files (4)

  • SKILL.md
  • LOG-STRUCTURE.md · references/
  • PITFALLS.md · references/
  • QUERIES.md · references/

SKILL.md (first lines)

# Query GCP Logs

Search GCP Cloud Logging for application errors, service logs, and traces.

## When to Use

- Investigating errors in GCP-hosted services
- Finding request traces for debugging
- Analyzing service behavior over time
- Correlating events across services

## Pre-flight Checks

### Authentication and Context
```bash
# Check gcloud auth
gcloud auth list 2>/dev/null | grep -q ACTIVE || {
  echo "Not authenticated. Run: gcloud auth login"
  exit 1
}

# Show current project
CURRENT_PROJECT=$(gcloud config get-value project 2>/dev/null)
echo "Current GCP Project: $CURRENT_PROJECT"

# If context suggests different project, prompt to switch
# Example: User mentions "production" but current project is "staging"
# Detect from query context and prompt:
# echo "Query mentions 'production' but current project is '$CURRENT_PROJECT'"
# echo "Switch to production project? Run: gcloud config set project example-production"
# read -p "Continue with current project? (y/n) " -n 1 -r
```

## Query Strategy

Follow this approach for effective log queries:

1. **Start simple**: Begin with basic filters (severity, service, timestamp)
2. **Verify data exists**: Check if logs are available in your time range
3. **Narrow time windows**: Use 1-2 hour windows for better performance
4. **Use two-stage filtering**: For complex logic, query broad → filter with jq
5. **Save to files**: Store large result sets for analysis
6. **Iterate**: Start broad, progressively add filters

### Example Workflow

```bash
# Step 1: Check if ANY logs exist in time range
gcloud logging read 'timestamp>="2025-12-24T10:00:00Z"' --limit=10

# Step 2: Filter to specific service
gcloud logging read 'resource.labels.container_name="api-gateway"' --limit=50

# Step 3: Add severity filter
gcloud logging read 'resource.labels.container_name="api-gateway" AND severity>=ERROR' --limit=100

# Step 4: Narrow time window
gcloud logging read \
  'resource.labels.container_name="api-gateway" AND severity>=ERROR AND timestamp>="2025-12-24T10:00:00Z" AND timestamp<="2025-12-24T11:00:00Z"' \
  --limit=100 \
  --format=json
```

## Output Management

For large outputs (>100 entries), save to tmp file:

```bash
# Save logs to tmp file
gcloud logging read 'severity>=ERROR' \
  --limit=1000 \
  --format=json > /tmp/gcp-errors-$(date +%Y%m%d-%H%M%S).json

# Then analyze with jq, grep, or other tools
cat /tmp/gcp-errors-*.json | jq '.[] | select(.severity=="CRITICAL")'
cat /tmp/gcp-errors-*.json | jq '.[] | .jsonPayload.message' | sort | uniq -c
```

**Benefits**:
- Preserve output for multiple operations
- Easier to analyze large result sets
- Share logs with team or attach to tickets

## Common Patterns

For detailed query examples, see:
- [Query patterns by severity, resource, time](references/QUERIES.md)
- [Log entry structure and fields](references/LOG-STRUCTURE.md)
- [Common pitfalls and solutions](references/PITFALLS.md)

### Quick Reference

```bash
# Errors from specific service
gcloud logging read 'resource.labels.container_name="service-name" AND severity>=ERROR' --limit=100

# Logs in time range
gcloud logging read 'timestamp>="2025-12-24T10:00:00Z" AND timestamp<="2025-12-24T11:00:00Z"' --limit=200

# Combined filters
gcloud logging read 'resource.labels.container_name="api" AND severity>=ERROR AND timestamp>="2025-12-24T10:00:00Z"' --format=json
```

## Output Format

- `--format=json` - Machine-readable JSON (recommended for piping to jq)
- `--format=table` - Human-readable table
- Default: Log entries with timestamps

## Tips

- Always single-quote filter strings to prevent shell interpretation
- Use `--limit` to control result count (default: 10)
- Use `--project` to override current project
- Combine filters with `AND`, `OR`, `NOT`
- Use ISO 8601 timestamps with timezone (e.g., "2025-12-24T10:00:00Z")
- For deep nesting or complex conditions, use two-stage filtering with jq
- Start with narrow time windows (1-2 hours) for better performance

From eveld/claude, MIT.

More from eveld/claude

Signals

Stars
10
Forks
2
Open issues
0
Last commit (this folder)
Feb 4, 2026 (8 months ago)
Last release
Dec 29, 2025 (10 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from eveld

Cite this page

gcp-logs skill. Agent Mart. https://agentmart.dev/skills/eveld-gcp-logs (last updated 2026-10-24)