linux rsyslog日志采集格式设定一
linux rsyslog日志采集格式设定一
linux rsyslog日志采集格式设定一
1.创建日志接收模板
打开/etc/rsyslog.conf文件,在GLOBAL DIRECTIVES模块下任意位置添加以下内容
命令:
vim /etc/rsyslog.conf
测试:rsyslog.conf文件结尾添加以下内容
$template ztj,"/var/log/%hostname%/%programname%.log"
*.* ?ztj
& ~
$template ztj,"/var/log/%hostname%/%programname%.log"
#定义模板ztj
#hostname:来自日志的主机名称
#programname:产生日志的进程名称,其值与%app-name%值相同
#可以通过man rsyslog.conf命令查看rsyslog属性(即:%hostname%和%programname%)
[root@rhel77 ~]# man rsyslog.conf
......
Available Propertiesmsg the MSG part of the message (aka "the message" ;))rawmsg the message exactly as it was received from the socket. Should be useful for debugging.HOSTNAMEhostname from the messageFROMHOSThostname of the system the message was received from (in a
最新文章
- Linux 本地zabbix结合内网穿透工具实现安全远程访问浏览器
- 11.13
- 看门狗怎么用
- 突破职场竞争,引领未来发展:考取《研发效能(DevOps)工程师职业技术认证》
- 同城服务共享台球室小程序系统:打造智能化的台球体验
- CPD:使用restAPI和cpd
- 桶装水订水小程序app,线上预约订水更便捷
- Debian中执行脚本 提示没有那个文件或目录
- 为什么打开idea时,没有启动页面,如何解决?
- Python武器库开发
- 上机实验三 图的最小生成树算法设计 西安石油大学数据结构
- 百度文心一言
- MySQL数据库——存储过程
- Rust字符串详解
- 智能化的同城服务共享台球室小程序系统,提升台球室运营效率
- samba服务器搭建 挂载远程目录常用配置参数介绍
- Java SE 封装、包、static关键字和代码块