資安工程師 syslog 格式說明 format 解讀

資料來源

https://en.wikipedia.org/wiki/Syslog

https://datatracker.ietf.org/doc/html/rfc5424

 

Time / IP / Host / Facilities / Priority / Tag / Message

Facility 設施

Facility code Keyword Description
0 kern

Kernel messages,核心訊息

1 user User-level messages,用戶級訊息
2 mail Mail system,郵件系統
3 daemon System daemons,系統守護程式
4 auth Security/authentication messages,安全/認證訊息
5 syslog Messages generated internally by syslogd,syslogd 內部產生的訊息
6 lpr Line printer subsystem,行式印表機子系統
7 news Network news subsystem,網路新聞子系統
8 uucp UUCP subsystem,UUCP子系統
9 cron Cron subsystem,定時子系統
10 authpriv Security/authentication messages,安全/認證訊息
11 ftp FTP daemon,FTP守護程式
12 ntp NTP subsystem,NTP子系統
13 security Log audit,日誌審計
14 console Log alert,日誌警報
15 solaris-cron Scheduling daemon,調度守護程式
16–23 local0 – local7 Locally used facilities,當地使用的設施

 

設施代碼 關鍵字 描述
0 克恩 核心訊息
1 使用者 用戶級訊息
2 郵件 郵件系統
3 守護程式 系統守護程式
4 授權 安全/認證訊息
5 系統日誌 syslogd 內部產生的訊息
6 LPR 行式印表機子系統
7 訊息 網路新聞子系統
8 烏卡普 UUCP子系統
9 計劃任務 定時子系統
10 授權權限 安全/認證訊息
11 文件傳輸協定 FTP守護程式
12 網路傳輸協定 NTP子系統
13 安全 日誌審計
14 安慰 日誌警報
15 Solaris-cron 調度守護程式
16–23 本地0 – 本地7 當地使用的設施

 

 

Severity level 嚴重程度

Value Severity Keyword Deprecated keywords Description Condition
0 Emergency emerg panic[9] System is unusable A panic condition.[10]
1 Alert alert   Action must be taken immediately A condition that should be corrected immediately, such as a corrupted system database.[10]
2 Critical crit   Critical conditions Hard device errors.[10]
3 Error err error[9] Error conditions  
4 Warning warning warn[9] Warning conditions  
5 Notice notice   Normal but significant conditions Conditions that are not error conditions, but that may require special handling.[10]
6 Informational info   Informational messages Confirmation that the program is working as expected.
7 Debug debug   Debug-level messages Messages that contain information normally of use only when debugging a program.[10]

 

價值 嚴重性 關鍵字 已棄用的關鍵字 描述 狀態
0 緊急狀況 emerg panic[9] 系統無法使用 恐慌狀態。[10]
1 警報 alert   必須立即採取行動 應立即糾正的情況,例如損壞的系統資料庫。[10]
2 批判的 crit   關鍵條件 硬設備錯誤。[10]
3 錯誤 err error[9] 錯誤狀況  
4 警告 warning warn[9] 警告條件  
5 注意 notice   正常但重要的情況 不是錯誤條件但可能需要特殊處理的條件。[10]
6 資訊性 info   資訊性訊息 確認程序按預期運作。
7 偵錯 debug   偵錯級訊息 包含通常僅在偵錯程式時使用的資訊的訊息。[10]

文字格式就是如下

日期 / 時間 / 優先等級 / 分類 / 程式名稱 / 訊息

2024-05-01    00:22:00    info        local2    IPPBX3510    Open port: 45.129.14.173:44228 -> 192.168.254.211:25 (TCP) SMTP
2024-05-01    00:21:54    info        local2    IPPBX3510    Local User (MAC=5E-39-7E-1C-E4-78): 192.168.254.211:25 -> 85.209.133.113:63899 (TCP) close connection

 

按照上面的說明

可以看出是那邊連那邊

 

iptable syslog

May  2 00:00:00 mail kernel: Connect-Out: IN= OUT=eth0 SRC=192.168.1.5 DST=168.95.1.1 LEN=63 TOS=0x00 PREC=0x00 TTL=64 ID=21754 DF PROTO=UDP SPT=49831 DPT=53 LEN=43

May  2 00:00:00 日期時間
mail 主機名稱
kernel 程序名稱
Connect-Out 連線方向
IN= 來源介面
OUT=eth0 出去介面
SRC=192.168.1.5 來源IP
DST=168.95.1.1 目的IP
LEN=63 封包表頭長度
TOS=0x00 
PREC=0x00 
TTL=64 回應時間
ID=21754 程序ID號碼
DF 
PROTO=UDP 封包協定UDP
SPT=49831 來源埠
DPT=53 目的埠
LEN=43 封包表頭長度

SEQ=  TCP序列號碼
ACK=  TCP應答號碼
WINDOWS=  IP包頭內窗口大小 / bytes
MAC=  網卡卡號

 

 

window size value:517
{Calculated window size: 132352}
{Window size scaling factor: 256}

517*256=132352

 

 

 

  • 文章瀏覽點擊數 1754662