日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux7添加syslog,在CentOS 7.2上使用rsyslog配置syslog server

發布時間:2023/12/20 linux 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux7添加syslog,在CentOS 7.2上使用rsyslog配置syslog server 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

--=========準備========

1.firewall狀態檢查

firewall-cmd --state

2.停止和禁用

systemctl stop firewalld.service

systemctl disable firewalld.service

3.檢查服務

systemctl status firewalld.service

4.檢查iptables

systemctl status iptables.service

systemctl stop iptables.service

--==========配置=========

1.打開配置文件

vim /etc/rsyslog.conf

2.啟用rsyslog從UDP 514端口接收日志

$ModLoad imudp

$UDPServerRun 514

3.啟用rsyslog從TCP 514端口接收日志

$ModLoad imtcp

$InputTCPServerRun 514

4.創建一個日志接收模板

在GLOBAL DIRECTIVES塊前,加入

$template RemoteLogs,"/var/log/%HOSTNAME%/%PROGRAMNAME%.log" *

*.*? ?RemoteLogs

備注:

The "& ~" sign represents a redirect rule, and is used to tell rsyslog daemon to stop processing log messages further, and not write them locally. If this redirection is not used, all the remote messages would be also written on local log files besides the log files described above, which means they would practically be written twice. Another consequence of using this rule is that the syslog server's own log messages would only be written to dedicated files named after machine's hostname.

加入規則:

#記錄所有日志類型的info級別以及大于info級別的信息,但是mail郵件信息,authpriv驗證方面的信息和cron時間任務相關的信息除外

*.info,mail.none,authpriv.none,cron.none??? ?RemoteLogs

5.

systemctl restart rsyslog

6.

netstat -tulpn | grep rsyslog

總結

以上是生活随笔為你收集整理的Linux7添加syslog,在CentOS 7.2上使用rsyslog配置syslog server的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。