LogWatch 客户端 - 包裹命令并上传日志到监控服务器
Project description
╔══════════════════════════════════════════════════════════════════════════╗
║ ║
║ ██╗ ██████╗ ██████╗ ██╗ ██╗ █████╗ ████████╗ ██████╗██╗ ██╗ ║
║ ██║ ██╔═══██╗██╔════╝ ██║ ██║██╔══██╗╚══██╔══╝██╔════╝██║ ██║ ║
║ ██║ ██║ ██║██║ ███╗██║ █╗ ██║███████║ ██║ ██║ ███████║ ║
║ ██║ ██║ ██║██║ ██║██║███╗██║██╔══██║ ██║ ██║ ██╔══██║ ║
║ ███████╗╚██████╔╝╚██████╔╝╚███╔███╔╝██║ ██║ ██║ ╚██████╗██║ ██║ ║
║ ╚══════╝ ╚═════╝ ╚═════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ║
║ ║
╚══════════════════════════════════════════════════════════════════════════╝
⚡ 实时日志监控客户端 ⚡
┌─────────────────────────────────────────────────────────────┐
│ 包裹任意命令 → 实时上传日志 → LogWatch 服务端 │
└─────────────────────────────────────────────────────────────┘
🚀 快速开始
📦 安装# 推荐使用 uv(更快)
uv tool install logwatch-client
# 或使用 pip
pip install logwatch-client
|
⚙️ 初始化# 交互式配置向导
lw --setup
# 健康检查
lw --health
|
🎯 运行任务
lw --user-id 104698 --user-token ut_xxx python long_running_test.py
🤖 AI 辅助安装与配置
让 AI 助手自动完成安装和配置流程
📋 准备工作
在开始之前,请准备以下信息:
- 🌐 服务端地址 — 例如
http://127.0.0.1:8000 - 🆔 用户 ID — 在网页中查看
- 🔑 用户 Token — 在网页设置中创建
✨ 一键安装(推荐)
复制以下内容发给 AI 助手(Codex / Claude Code):
请帮我安装和配置 logwatch-client:
参考 AI 协作手册 (https://raw.githubusercontent.com/Becomingw/logwatch_client/refs/heads/main/docs/ai-assistant-playbook.md) 来完成
🛠️ 手动安装
# 安装客户端
uv tool install logwatch-client || pip install logwatch-client
# 运行配置向导
lw --setup
# 验证安装
lw --health
📝 配置文件
配置文件路径: ~/.lwconfig
最小可用配置
server=http://127.0.0.1:8000
machine=my-macbook
user_id=104698
user_token=ut_xxx
💡 鉴权说明: 客户端上报接口统一使用
user_id + user_token
💻 常用命令
# 配置向导
lw --setup
# 健康检查
lw --health
# 运行任务(带名称)
lw --name "train-exp-1" python train.py
# 指定服务器
lw --server http://127.0.0.1:8000 python train.py
# 跳过连通性检查
lw --no-check python train.py
📖 命令行参数
| 参数 | 简写 | 说明 |
|---|---|---|
--name |
-n |
任务名称 |
--server |
-s |
服务器地址 |
--machine |
-m |
机器标识 |
--user-id |
-u |
用户 ID |
--user-token |
— | 用户 Token |
--setup |
— | 交互式配置向导(含连通+上报测试) |
--health |
— | 健康检查(连通性/队列/离线邮件) |
--no-check |
— | 跳过启动前连通性检查 |
--init |
— | 已废弃,等价于 --setup |
⚙️ 完整配置项
展开查看所有配置选项
# ═══════════════════════════════════════════════════════════
# 基础配置
# ═══════════════════════════════════════════════════════════
server=http://127.0.0.1:8000
machine=my-macbook
user_id=104698
user_token=ut_xxx
# ═══════════════════════════════════════════════════════════
# 上传配置
# ═══════════════════════════════════════════════════════════
upload_interval_seconds=2
batch_size=100
batch_interval_ms=5000
compression_level=6
publish_grace_seconds=1
upload_circuit_break_max=5
# ═══════════════════════════════════════════════════════════
# 日志管理
# ═══════════════════════════════════════════════════════════
log_retention_days=7
log_max_files=1000
force_offline=false
# ═══════════════════════════════════════════════════════════
# 邮件通知
# ═══════════════════════════════════════════════════════════
email_enabled=false
email_notify_on=all
email_notify_on_start=false
smtp_host=smtp.example.com
smtp_port=465
smtp_user=your-email@example.com
smtp_pass=your-password
smtp_use_tls=true
email_from=your-email@example.com
email_to=notify@example.com
🔧 运行机制
📁 本地存储
|
📤 上传策略
|
🔍 健康检查
|
┌─────────────────────────────────────────────────────────────┐
│ │
│ Made with ⚡ by LogWatch Team │
│ 📚 Documentation • 🐛 Issues • 💬 Discussions │
│ │
└─────────────────────────────────────────────────────────────┘
© 2024 LogWatch • MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
logwatch_client-0.1.4b1.tar.gz
(26.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logwatch_client-0.1.4b1.tar.gz.
File metadata
- Download URL: logwatch_client-0.1.4b1.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
448d940aa69c62b8361a26e8ef3cef6c75a00e8b56293bf547e62a444b9dda09
|
|
| MD5 |
a8d4137f2e90809b54daa28bf515c73a
|
|
| BLAKE2b-256 |
5d2adb85bfda07c011c5c8558b2fd07ff441904dbbc7f89ddc912d5d06474e15
|
File details
Details for the file logwatch_client-0.1.4b1-py3-none-any.whl.
File metadata
- Download URL: logwatch_client-0.1.4b1-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b19115431b2d44a219a874c8a00f9141eae7574ab5685c01ddc45fc4c73a816b
|
|
| MD5 |
23dad7a310277e8fa285596f9ed178e3
|
|
| BLAKE2b-256 |
331d72e2f2a6c2089cf5a8f76bbabf97269df5a7e5d7cc3a0e2319bd7bf37865
|