Skip to content
Back to skills

Managing Papertrail

ASecurity

Use when working with Papertrail — papertrail cloud-hosted log management for log aggregation, search, tail, alerting, and archiving. Covers log searching, system and group management, saved search alerts, and log volume analysis. Use when searching Papertrail logs, investigating incidents via log data, managing log groups and systems, or configuring log-based alerts.

  • 6 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 8, 2026
toolspythonbashapisecuritydocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 8, 2026

npx -y skills add cloudthinker-ai/CloudSkills --skill managing-papertrail --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Managing Papertrail?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Managing Papertrail
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/cloudthinker-ai-managing-papertrail/badge)](https://www.skillsdirectory.com/skills/cloudthinker-ai-managing-papertrail)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: managing-papertrail
description: |
  Use when working with Papertrail — papertrail cloud-hosted log management for
  log aggregation, search, tail, alerting, and archiving. Covers log searching,
  system and group management, saved search alerts, and log volume analysis. Use
  when searching Papertrail logs, investigating incidents via log data, managing
  log groups and systems, or configuring log-based alerts.
connection_type: papertrail
preload: false
---

# Papertrail Monitoring Skill

Query, analyze, and manage Papertrail log data using the Papertrail API.

## API Overview

Papertrail uses a REST API at `https://papertrailapp.com/api/v1`.

### Core Helper Function

```bash
#!/bin/bash

pt_api() {
    local method="$1"
    local endpoint="$2"
    curl -s -X "$method" "https://papertrailapp.com/api/v1/${endpoint}" \
        -H "X-Papertrail-Token: $PAPERTRAIL_API_TOKEN"
}

pt_search() {
    local query="$1"
    local group_id="${2:-}"
    local params="q=$(python3 -c "import urllib.parse; print(urllib.parse.quote('${query}'))")"
    [ -n "$group_id" ] && params="${params}&group_id=${group_id}"
    pt_api GET "events/search.json?${params}"
}
```

## MANDATORY: Discovery-First Pattern

**Always discover systems, groups, and saved searches before querying.**

### Phase 1: Discovery

```bash
#!/bin/bash

echo "=== Systems ==="
pt_api GET "systems.json" | jq -r '.[] | "\(.id)\t\(.name)\t\(.hostname)\t\(.ip_address)"' | head -20

echo ""
echo "=== Groups ==="
pt_api GET "groups.json" | jq -r '.[] | "\(.id)\t\(.name)\tsystems:\(.system_count)"' | head -15

echo ""
echo "=== Saved Searches ==="
pt_api GET "searches.json" | jq -r '.[] | "\(.id)\t\(.name)\t\(.query)"' | head -15

echo ""
echo "=== Log Destinations ==="
pt_api GET "destinations.json" | jq -r '.[] | "\(.id)\t\(.type)\t\(.description // "N/A")"' | head -10
```

### Phase 2: Analysis

```bash
#!/bin/bash
QUERY="${1:-error}"

echo "=== Log Search: ${QUERY} ==="
pt_search "$QUERY" | jq -r '.events[] | "\(.received_at[0:19])\t\(.source_name)\t\(.message[0:80])"' | head -20

echo ""
echo "=== System Activity (recent logs) ==="
pt_api GET "systems.json" \
    | jq -r '.[] | "\(.name)\t\(.last_event_at // "never")"' \
    | sort -t$'\t' -k2 -r | head -15

echo ""
echo "=== Search Alerts ==="
pt_api GET "searches.json" \
    | jq -r '.[] | select(.alerts | length > 0) | "\(.name)\t\(.query)\talerts:\(.alerts | length)"' | head -10

echo ""
echo "=== Account Usage ==="
pt_api GET "accounts.json" | jq -r '"Plan: \(.plan.name)\nLog data rate: \(.log_data_transfer_used_percent // 0)%"'
```

## Output Rules
- **TOKEN EFFICIENCY**: Target ≤50 lines — limit search results and use `head` in output
- Use system/group filtering to narrow log searches
- Prefer saved searches for recurring investigations

## Output Format

Present results as a structured report:
```
Managing Papertrail Report
══════════════════════════
Resources discovered: [count]

Resource       Status    Key Metric    Issues
──────────────────────────────────────────────
[name]         [ok/warn] [value]       [findings]

Summary: [total] resources | [ok] healthy | [warn] warnings | [crit] critical
Action Items: [list of prioritized findings]
```

Target ≤50 lines of output. Use tables for multi-resource comparisons.

## Anti-Hallucination Rules

1. **NEVER assume resource names** — always discover via CLI/API in Phase 1 before referencing in Phase 2.
2. **NEVER fabricate metric names or dimensions** — verify against the service documentation or `--help` output.
3. **NEVER mix CLI commands between service versions** — confirm which version/API you are targeting.
4. **ALWAYS use the discovery → verify → analyze chain** — every resource referenced must have been discovered first.
5. **ALWAYS handle empty results gracefully** — an empty response is valid data, not an error to retry.

## Counter-Rationalizations

| Shortcut | Counter | Why |
|----------|---------|-----|
| "I'll skip discovery and check known resources" | Always run Phase 1 discovery first | Resource names change, new resources appear — assumed names cause errors |
| "The user only asked for a quick check" | Follow the full discovery → analysis flow | Quick checks miss critical issues; structured analysis catches silent failures |
| "Default configuration is probably fine" | Audit configuration explicitly | Defaults often leave logging, security, and optimization features disabled |
| "Metrics aren't needed for this" | Always check relevant metrics when available | API/CLI responses show current state; metrics reveal trends and intermittent issues |
| "I don't have access to that" | Try the command and report the actual error | Assumed permission failures prevent useful investigation; actual errors are informative |

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.