Linux配置日志服務器



title: Linux配置日志服務器
tags: linux, 日志服務器

Linux配置日志服務器


日志服務器配置文件:/etc/rsyslog.conf

服務器端:

服務器IP如下:
enter description here

編輯日志服務器的配置文件:
enter description here

這里UDP或者TCP任選一個
enter description here

將注釋的兩句復制一遍,然后取消注釋即可
enter description here

進入目錄下創建配置文件,配置需要監控的客戶端
enter description here

Vim編輯器打開
enter description here
內容如下:
enter description here

內容格式如下:
:屬性, 比較操作符, "值" 保存位置

屬性包括以下內容
fromhost 哪個主機名發過來的
fromhost-ip 哪個ip發過來的
msg 從日志信息里的內容判斷
hostname 從日志中的主機名判斷
比較操作符包括以下內容
contains 包含
isequal 等於
startswith 以...開頭

重啟日志服務
enter description here

可以看到目標目錄下已經生成一個目錄記錄文件,且內容為空
enter description here

客戶機端:

客戶機端IP為:192.168.0.100/24

編輯配置文件:
enter description here
在末尾加上如下行指定日志服務器地址和端口號
enter description here
保存退出,重啟日志服務
enter description here

開始驗證:
用服務器端通過ssh試圖連接客戶端:
enter description here

由於輸入密碼,連接失敗

現在在去查看日志記錄文件:
enter description here

如上,ssh連接的記錄已經被記錄在日志文件中


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM