Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

log-analysis

БесплатноБез исполняемых скриптовНе проверен

Analyze, filter, transform, and convert log files with Kelora. Use for exploring unknown logs, investigating incidents and stack traces, comparing logs before…

dlossот dloss★ 50 звёзд на GitHub16 установок в других каталогах

Об этом скилле

Log Analysis with Kelora

Kelora is a streaming log processor with embedded Rhai scripting. It auto-detects formats (JSON, logfmt, syslog, Apache/combined, CSV, and built-in app-log formats such as cri, postgres, nginx-error, log4j, python-logging), handles files that mix formats, transparently decompresses .gz/.zst, and ships 150+ built-in functions.

Getting Help

Kelora ships its own reference — consult it before guessing or asking the user:

  • kelora -h - One-screen quick reference
  • kelora --help [KEYWORD] - Full CLI reference (KEYWORD searches it, e.g. --help since)
  • kelora --help-functions [KEYWORD] - All 150+ functions (e.g. --help-functions ip)
  • kelora --help-examples - End-to-end patterns
  • kelora --help-rhai - Rhai scripting guide and stage semantics
  • kelora --help-formats - Input/output formats and the fields each one extracts
  • kelora --help-time - Timestamp formats and --since/--until syntax
  • kelora --help-multiline - Multiline strategies (-M)
  • kelora --help-regex - Regex parsing (-f regex:...)

1. Explore an Unknown Log

Always profile first — field names depend on the format and are the most common source of empty results:

kelora -d app.log                      # Fields, types, cardinality, samples; footer names the detected format
kelora -d=json app.log                 # Same, machine-readable
kelora --drain -k msg app.log          # Cluster messages into templates (one text field in -k)
kelora -n 5 app.log                    # Peek at the first events

On a large file, add --head 10000 to read only the first N lines. If -d reports format line, kelora found no structure: extract fields with -f 'cols:ts(N) level *msg' (N = whitespace tokens in the timestamp; the hint names it when it can tell) or -f 'regex:...' (see --help-formats, --help-regex).

2. Investigate an Incident

Narrow down:

kelora -l error,warn app.log                           # By level (case-insensitive)
kelora --filter 'e.duration_ms > 1000' app.log         # By expression
kelora --since 1h app.log                              # Last hour (also: now-15m, 2024-01-15T10:00:00Z)
kelora --since 10:00 --until since+30m app.log         # Anchored window
kelora -C 2 -l error app.log                           # 2 events of context around each match

Count and time:

kelora --freq level app.log                            # Count per distinct value (repeatable)
kelora --describe duration_ms app.log                  # count/min/max/avg/p50/p95/p99
kelora --card user.id app.log                          # Approx distinct count (dotted paths work here)
kelora --span 10m --span-summary app.log               # Events per 10-minute window
kelora --span 10m --span-summary --freq level app.log  # ...broken down by level
kelora -s app.log                                      # Overall stats: format, counts, parse errors, time span

These metric flags print only the aggregate (they imply -q). Output defaults to an aligned table on a terminal and tsv when piped, so --freq msg | sort -k3 -nr | head gives a top-N; pass --metrics=json for JSON.

Stack traces: group each trace into one event with a preset, then filter or cluster it like any other event:

kelora -f line -M java trace.log --filter 'e.line.contains("Caused by")'
kelora -f line -M python app_py.log --drain -k line

Presets: java, python, go, plus timestamp, indent, blank (paragraphs) and regex:match=... for custom boundaries. Kelora hints (💡) at the right preset when it sees traces.

3. Find What Changed (Before/After)

--drain-diff compares message templates between two logs, ignoring the variable parts (IDs, numbers, durations):

kelora --drain-diff=table -k msg before.log after.log            # Two files: baseline, target
kelora --drain-diff -k msg --cut-at 2024-01-15T10:00:30Z deploy.log   # One file, split at a time
kelora --drain-diff -k msg --cut-before 'e.msg.contains("deploy")' deploy.log  # ...or at the first match

The table view reads like a diff: + templates only in the target, - templates that disappeared, * templates whose rate changed materially (e.g. "14x more"), plus a footer on what stayed the same. Without =table, piped output is TSV (new/gone/freq_changed rows, no footer); use =json to parse it.

4. Transform and Convert

kelora -e 'e.duration_s = e.duration_ms / 1000.0' -k msg,duration_s app.log   # 1000.0: integer / integer truncates
kelora -e 'e.absorb_json("data")' events.log                     # Parse embedded JSON into fields
kelora -f combined -F json access.log > access.jsonl             # Apache/nginx access log to JSON
kelora -j -F logfmt events.jsonl                                 # JSON to logfmt
kelora -f syslog -F csv -k ts,host,level,msg syslog.log          # Syslog to CSV (csv needs -k)
kelora -m -e 'track_freq("per_10m", meta.parsed_ts.round_to("10m"))'
Полный SKILL.md на GitHub

Установить log-analysis в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл log-analysis?

Analyze, filter, transform, and convert log files with Kelora. Use for exploring unknown logs, investigating incidents and stack traces, comparing logs before and after a deploy, counting or timing events (frequencies, percentiles, per-minute histograms), or converting between JSON, logfmt, syslog, Apache/combined, and CSV.

Как установить скилл log-analysis?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл log-analysis запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить log-analysis с