← 返回
未分类 中文

Pilot Event Log

Persistent NDJSON event logging with rotation, compression, and retention policies. Use this skill when: 1. You need persistent storage of event streams 2. Y...
持久 NDJSON 事件日志记录,支持轮转、压缩和保留策略。适用场景:1. 需要持久存储事件流;2. 你需要...
teoslayer teoslayer 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 385
下载
💾 0
安装
1
版本
#latest

概述

Pilot Event Log

Persistent NDJSON logging of Pilot Protocol event streams with rotation and compression.

Commands

Subscribe and Log

pilotctl --json subscribe <source> <topic> --timeout <seconds> | jq -c '.data.events[]' >> <log-file.ndjson>

Query by Time

jq -c --arg start "2026-04-08T00:00:00Z" --arg end "2026-04-08T23:59:59Z" \
  'select(.timestamp >= $start and .timestamp <= $end)' events.ndjson

Query by Topic

jq -c 'select(.topic | startswith("alerts."))' events.ndjson

Rotate Logs

[ "$(du -m "$log_file" | cut -f1)" -ge "$MAX_SIZE_MB" ] && mv "$log_file" "$log_file.$(date +%s)" && gzip "$log_file.$(date +%s)" &

Compress Old Logs

find /var/log/pilot-events -name "events-*.ndjson" -mtime +1 -exec gzip {} \;

Retention Cleanup

find /var/log/pilot-events -name "events-*.ndjson.gz" -mtime +90 -delete

Workflow Example

#!/bin/bash
# Production event logging

SOURCE="${1:-production-app}"
LOG_DIR="/var/log/pilot-events/$SOURCE"
MAX_SIZE_MB=500

mkdir -p "$LOG_DIR"
log_file="$LOG_DIR/current.ndjson"

while true; do
  pilotctl --json subscribe "$SOURCE" "*" --timeout 600 | jq -c '.data.events[]? // empty' | \
  while IFS= read -r event; do
    echo "$event" | jq -c '. + {logged_at: (now | todate)}' >> "$log_file"

    size_mb=$(du -m "$log_file" 2>/dev/null | cut -f1)
    if [ "${size_mb:-0}" -ge "$MAX_SIZE_MB" ]; then
      rotated="$LOG_DIR/events-$(date +%Y%m%d-%H%M%S).ndjson"
      mv "$log_file" "$rotated" && gzip "$rotated" &
    fi
  done
  sleep 5
done

Dependencies

Requires pilot-protocol skill, jq (1.6+), gzip, and running daemon.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 06:08 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 683 📥 330,492
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 79 📥 182,809
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 197 📥 68,108