项目技术文档:remote_syslog
2024-12-20 22:14:47作者:贡沫苏Truman
1. 安装指南
安装步骤
-
使用以下命令安装
remote_sysloggem:$ [sudo] gem install remote_syslog -
可选步骤:创建一个
log_files.yml文件,指定要读取的日志文件路径以及日志发送的目标主机和端口(参考examples/log_files.yml.example)。这些配置也可以通过命令行参数指定。
自动启动
-
将示例的 init 文件复制到系统中:
$ cp examples/remote_syslog.init.d /etc/init.d/remote_syslog $ chmod 755 /etc/init.d/remote_syslog -
确保
remote_syslog在系统启动时自动启动:$ sudo update-rc.d remote_syslog defaults或者手动创建链接:
$ sudo ln -s /etc/init.d/remote_syslog /etc/rc3.d/S30remote_syslog
使用 RVM
如果使用 Ruby 版本管理器(如 RVM),需要在 init 文件中加载 RVM 环境。可以参考 RVM 的 init.d 集成指南 创建一个 wrapper 脚本。
2. 项目使用说明
基本用法
$ remote_syslog [OPTION]... <FILE>...
常用选项
-c, --configfile PATH:指定配置文件路径(默认/etc/log_files.yml)-d, --dest-host HOSTNAME:指定目标 syslog 主机名或 IP(默认logs.papertrailapp.com)-p, --dest-port PORT:指定目标 syslog 端口(默认514)-D, --no-detach:不以守护进程方式运行-f, --facility FACILITY:指定设施(默认user)--hostname HOST:指定本地主机名-P, --pid-dir DIRECTORY:已弃用:指定 PID 文件目录--pid-file FILENAME:指定 PID 文件路径(默认/var/run/remote_syslog.pid)--parse-syslog:解析文件为 syslog 格式-s, --severity SEVERITY:指定日志级别(默认notice)--strip-color:去除颜色代码--tls:通过 TLS 连接--tcp:通过 TCP 连接(无 TLS)--new-file-check-interval INTERVAL:检查新文件的时间间隔
示例
-
使用配置文件
configs/logs.yml和端口12345发送/var/log/mysqld.log的日志:$ remote_syslog -c configs/logs.yml -p 12345 /var/log/mysqld.log -
不以守护进程方式运行,使用
/etc/log_files.yml配置文件,PID 文件路径为/tmp/remote_syslog.pid,发送日志到a.example.com:514:$ remote_syslog -D -d a.example.com -f local0 --pid-file /tmp/remote_syslog.pid /var/log/mysqld.log
3. 项目API使用文档
配置文件格式
log_files.yml 文件格式如下:
files:
- /var/log/httpd/access_log
- /var/log/httpd/error_log
- /var/log/mysqld.log
- /var/run/mysqld/mysqld-slow.log
destination:
host: logs.papertrailapp.com
port: 12345
高级配置
-
覆盖主机名:
hostname: somehostname -
验证服务器证书:
ssl_server_cert: syslog.crt -
使用客户端证书:
ssl_client_cert_chain: syslog_client.crt ssl_client_private_key: syslog_client.key -
排除文件:
exclude_files: - \.\d$ - .bz2 - .gz
4. 项目安装方式
安装命令
$ [sudo] gem install remote_syslog
配置文件
默认情况下,remote_syslog 会查找 /etc/log_files.yml 配置文件。可以参考 examples/log_files.yml.example 创建配置文件。
启动命令
$ remote_syslog -c configs/logs.yml -p 12345 /var/log/mysqld.log
自动启动
通过 init 文件或手动启动脚本实现自动启动。
登录后查看全文
热门项目推荐
atomcodeClaude Code 的开源替代方案。连接任意大模型,编辑代码,运行命令,自动验证 — 全自动执行。用 Rust 构建,极致性能。 | An open-source alternative to Claude Code. Connect any LLM, edit code, run commands, and verify changes — autonomously. Built in Rust for speed. Get StartedRust0130- DDeepSeek-V4-ProDeepSeek-V4-Pro(总参数 1.6 万亿,激活 49B)面向复杂推理和高级编程任务,在代码竞赛、数学推理、Agent 工作流等场景表现优异,性能接近国际前沿闭源模型。Python00
MiMo-V2.5-ProMiMo-V2.5-Pro作为旗舰模型,擅⻓处理复杂Agent任务,单次任务可完成近千次⼯具调⽤与⼗余轮上 下⽂压缩。Python00
GLM-5.1GLM-5.1是智谱迄今最智能的旗舰模型,也是目前全球最强的开源模型。GLM-5.1大大提高了代码能力,在完成长程任务方面提升尤为显著。和此前分钟级交互的模型不同,它能够在一次任务中独立、持续工作超过8小时,期间自主规划、执行、自我进化,最终交付完整的工程级成果。Jinja00
MiniCPM-V-4.6这是 MiniCPM-V 系列有史以来效率与性能平衡最佳的模型。它以仅 1.3B 的参数规模,实现了性能与效率的双重突破,在全球同尺寸模型中登顶,全面超越了阿里 Qwen3.5-0.8B 与谷歌 Gemma4-E2B-it。Jinja00
MiniMax-M2.7MiniMax-M2.7 是我们首个深度参与自身进化过程的模型。M2.7 具备构建复杂智能体应用框架的能力,能够借助智能体团队、复杂技能以及动态工具搜索,完成高度精细的生产力任务。Python00
热门内容推荐
最新内容推荐
项目优选
收起
暂无描述
Dockerfile
722
4.64 K
Ascend Extension for PyTorch
Python
594
747
openEuler内核是openEuler操作系统的核心,既是系统性能与稳定性的基石,也是连接处理器、设备与服务的桥梁。
C
425
375
本项目是CANN提供的数学类基础计算算子库,实现网络在NPU上加速计算。
C++
989
978
暂无简介
Dart
967
246
Oohos_react_native
React Native鸿蒙化仓库
C++
345
390
Claude Code 的开源替代方案。连接任意大模型,编辑代码,运行命令,自动验证 — 全自动执行。用 Rust 构建,极致性能。 | An open-source alternative to Claude Code. Connect any LLM, edit code, run commands, and verify changes — autonomously. Built in Rust for speed.
Get Started
Rust
893
130
deepin linux kernel
C
29
16
昇腾LLM分布式训练框架
Python
159
188
🎉 (RuoYi)官方仓库 基于SpringBoot,Spring Security,JWT,Vue3 & Vite、Element Plus 的前后端分离权限管理系统
Vue
1.65 K
965