Skip to content
Skillpedia
Deploy & cloud (DevOps)41k Β· #6888

authoring-log-alerts

What it does

This skill chooses which services to watch, sets alert thresholds from real log patterns, and tests them before you turn them on. It is for teams who want useful alerts without a flood of noise.

When to use it

  • βœ“When you want to set up alerts for your logs and do not know where to start.
  • βœ“When you want to check whether a service produces logs worth alerting on.
  • βœ“When you have just turned on log alerts and need a starter set.

Skill link

https://github.com/PostHog/posthog/blob/master/products/logs/skills/authoring-log-alerts/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/PostHog/posthog/blob/master/products/logs/skills/authoring-log-alerts/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œSet up a few useful log alerts for my services so I only hear about real problems.”

5 new skills a week. 1 minute to read.

How it works

It finds the busiest services and their error rates, looks at a normal baseline, and drafts thresholds. It then tests the thresholds on past data before you choose where the notifications go.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Authoring log alerts

Authoring an alert is a measurement problem, not a guessing problem. You are not trying to be exhaustive β€” you are trying to land thresholds that fire 0–3 times per week on real production patterns, on services that matter.

When to use this skill

  • The user asks to "set up alerts" / "suggest alerts" for their project.
  • The user wants to evaluate whether a service is producing alertable signal.
  • The user has just enabled log alerting and wants a starter set.

When not to use this skill

  • Tuning an alert that already exists β€” that's a different job (use posthog:logs-alerts-events-list to inspect fire/resolve cadence and posthog:logs-alerts-partial-update to adjust).
  • Investigating an active incident β€” pull rows with posthog:query-logs, don't author an alert mid-incident.

Tools

Tool Job Where it fits
posthog:logs-services Top-25 services in window with log_count, error_count, error_rate, sparkline. Step 1 β€” triage.
posthog:logs-attributes-list / posthog:logs-attribute-values-list Discover keys/values for narrower filters. Step 2, optional.
posthog:logs-count-ranges Adaptive time-bucketed counts for a filter. Step 3 β€” baseline.
posthog:logs-alerts-simulate-create Replay a draft config against -7d history with full state machine. Step 4 β€” validate.
posthog:logs-alerts-create Persist the alert. Step 5 β€” ship.
posthog:logs-alerts-destinations-create Wire the alert to Slack, webhook, or Microsoft Teams. Step 5: ship.

Do not call posthog:query-logs during authoring. You need distributions, not rows. Reserve posthog:query-logs for the very end if the user asks "show me a sample of what would have fired" β€” limit: 10 is plenty.

Workflow

1. Triage β€” pick candidate services

Call posthog:logs-services for the last 24h with no filters. The response is capped at 25 services and includes a sparkline, so it is small and bounded.

A service is a candidate when both are true:

  • log_count is non-trivial (β‰₯ ~1k in 24h β€” quieter services produce too little signal to alert on).
  • error_rate is non-zero, or the user has named the service explicitly.

Skip services with high volume but error_rate == 0 unless the user wants a volume-shape alert (e.g. "warn me if api-gateway suddenly stops producing logs"). Volume-floor alerts use threshold_operator: below and need different reasoning β€” see references/volume-floor-alerts.md.

If the user names a service, treat it as a candidate even without error signal.

2. (Optional) Narrow the filter

If a service has many error sub-types, an alert on "all errors" is usually too broad. Use posthog:logs-attributes-list (try attribute_type: log) and posthog:logs-attribute-values-list to find a discriminator β€” common ones are http.status_code, error.type, k8s.container.name. Add the narrowing filter to your draft.

Keep it simple: one severity filter + one or two attribute filters is plenty. Multi-clause filters are harder to reason about and rarely improve precision.

3. Baseline β€” characterise the candidate over 7 days

Call posthog:logs-count-ranges with the candidate's filters, dateRange: { date_from: "-7d" }, and targetBuckets: 24 (one bucket β‰ˆ 7h). The response gives you bucket counts.

Do not eyeball the percentiles or scale the threshold to the alert window manually. Pipe the count-ranges response into the helper script:

echo '<count-ranges JSON>' | python3 scripts/baseline_stats.py --window-minutes 5

The script returns:

{
  "n_buckets": 12,
  "bucket_minutes": 420.0,
  "alert_window_minutes": 5,
  "stats": { "p50": 12.0, "p95": 71.25, "p99": 126.25, "max": 140 },
  "suggested_thresho
FAQ

How often should an alert fire?

The aim is for each alert to fire about 0 to 3 times a week, so the alerts stay useful.

Can it tune an alert that already exists?

No. Adjusting an existing alert is a separate job that this skill does not cover.

Can it help during an active incident?

No. During an incident, you should look at the logs directly instead of creating alerts.

Details

Original description by the author

Author useful, low-noise log alerts on services in a PostHog project. Use when the user asks to set up alerts for their logs, suggest alerts they should add, or evaluate whether a service is worth monitoring. Covers service triage, baseline characterisation, threshold drafting, back-testing via simulate, and shipping with a notification destination.

repo: PostHog/posthog

Popularity

GitHub stars
41k
Ranking position
#6888
License
β€”
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills