准备syslog日志服务器
可以选择的很多,这里选择了syslog watcher,比较喜欢这种简洁而且安装包小的软件包
配置OpenWrt设备
采用Linux下比较熟悉的syslogd服务
root@:~# ps -w | grep logd
525 root 1520 S /sbin/syslogd -C4
527 root 1516 S /sbin/klogd
15104 root 1516 S N grep logd
复制
在OpenWrt中相应的配置文件位于
/etc/config/system
复制
几个system段里相关的配置
log_ip: syslog服务器的IP地址
log_port:syslog服务器日志发送的端口号,默认514
log_proto:日志以tcp、udp形式发送,默认udp
log_remote:远程日志开关
log_prefix:在发送给syslog日志的添加前缀
log_hostname:配置发送给syslog服务器的hostname,默认为主机hostname
复制
重启设备进行测试
root@:~# logger "This is han's syslog test"
root@:~# logger "This is han's syslog test"
root@:~# logger "This is han's syslog test"
root@:~# logger "This is han's syslog test"
root@:~# logger "This is han's syslog test"
复制
使用syslog在shell下可以使用logger命令,在C中使用syslog对应的API即可
root@:~# logger --help
BusyBox v1.19.4 (2019-09-02 18:22:29 CST) multi-call binary.
Usage: logger [OPTIONS] [MESSAGE]
Write MESSAGE (or stdin) to syslog
-s Log to stderr as well as the system log
-t TAG Log using the specified tag (defaults to user name)
-p PRIO Priority (numeric or facility.level pair)
复制
文章转载自han码录,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
数据库国产化替代深化:DBA的机遇与挑战
代晓磊
1258次阅读
2025-04-27 16:53:22
2025年4月国产数据库中标情况一览:4个千万元级项目,GaussDB与OceanBase大放异彩!
通讯员
731次阅读
2025-04-30 15:24:06
国产数据库需要扩大场景覆盖面才能在竞争中更有优势
白鳝的洞穴
598次阅读
2025-04-14 09:40:20
【活动】分享你的压箱底干货文档,三篇解锁进阶奖励!
墨天轮编辑部
510次阅读
2025-04-17 17:02:24
一页概览:Oracle GoldenGate
甲骨文云技术
478次阅读
2025-04-30 12:17:56
GoldenDB数据库v7.2焕新发布,助力全行业数据库平滑替代
GoldenDB分布式数据库
471次阅读
2025-04-30 12:17:50
优炫数据库成功入围新疆维吾尔自治区行政事业单位数据库2025年框架协议采购!
优炫软件
362次阅读
2025-04-18 10:01:22
给准备学习国产数据库的朋友几点建议
白鳝的洞穴
304次阅读
2025-05-07 10:06:14
XCOPS广州站:从开源自研之争到AI驱动的下一代数据库架构探索
韩锋频道
284次阅读
2025-04-29 10:35:54
国产数据库图谱又上新|82篇精选内容全览达梦数据库
墨天轮编辑部
275次阅读
2025-04-23 12:04:21