chriszg 发表于 2019-2-16 10:12:31

CentOS 7 修改日志时间戳格式

  默认的时间戳格式是

Jul 14 13:30:01 localhost systemd: Starting Session 38 of user root.  看着不是很方便,现修改为以下格式

2018-07-14 13:32:57 desktop0 systemd: Starting System Logging Service...  修改 /etc/rsyslog.conf
# Use default timestamp format
#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat # 这行是原来的将它注释,添加下面两行
$template CustomFormat,"%$NOW% %TIMESTAMP:8:15% %HOSTNAME% %syslogtag% %msg%\n"
$ActionFileDefaultTemplate CustomFormat  然后重启 rsyslog 服务
systemctl restart rsyslog.service


页: [1]
查看完整版本: CentOS 7 修改日志时间戳格式