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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Nxlog日志过滤

發布時間:2023/12/31 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Nxlog日志过滤 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一般情況下nxlog只用于windows2008以及以上版本的日志轉發(即使用im_msvistalog模式),實測08以下版本日志轉發時出現亂碼。

?

?im_msvistalog使用以下字段

?

$raw_event (type: string) 包含$EventTime、$Hostname、$Severity、$EventID和$Message的字符串 $AccountName (type: string) 與事件關聯的用戶名。 $AccountType (type: string) 包含$EventTime、$Hostname、$Severity、$EventID和$Message的字符串 $ActivityID (type: string) 當前活動的全局惟一標識符,存儲在EvtSystemActivityID中。 $Category (type: string) 從任務解析的類別名稱。 $Channel (type: string)事件源的通道 (例如,安全性或應用程序)。 $Domain (type: string) 用戶的域名。 $EventID (type: integer) EvtSystemEventID字段中的事件ID(特定于事件源)。 $EventTime (type: datetime) EvtSystemTimeCreated 字段 $EventType (type: string) 事件的類型,它是一個描述嚴重性的字符串。這將從EvtSystemLevel轉換為它的字符串表示形式。可能的值有:CRITICAL、ERROR、AUDIT_FAILURE、AUDIT_SUCCESS、INFO、WARNING和VERBOSE。 $EventXML (type: string) XML格式的原始事件數據。如果模塊的CaptureEventXML指令設置為TRUE,則此字段可用。 $ExecutionProcessID (type: integer) 事件生成器的進程標識符,如EvtSystemProcessID。 $Hostname (type: string) EvtSystemComputer 字段. $Keywords (type: string) EvtSystemKeywords字段的值。 $Message (type: string) 事件的消息。 $Opcode (type: string) 從OpcodeValue解析的操作碼字符串。 $OpcodeValue (type: integer) 事件在EvtSystemOpcode中的操作碼號。 $ProviderGuid (type: string) 事件提供者的全局唯一標識符,存儲在EvtSystemProviderGuid中。這對應于$SourceName字段中的提供者名稱。 $RecordNumber (type: integer) 事件記錄的數目。. $RelatedActivityID (type: string) 存儲在EvtSystemRelatedActivityID中的RelatedActivityID。 $Severity (type: string) 事件的標準化嚴重性名稱。請參見$ SeverityValue。 $SeverityValue (type: integer) 事件的規范化嚴重程度編號,映射見表格。 $SourceName (type: string) 從EvtSystemProviderName字段生成事件的事件源。 $TaskValue (type: integer) EvtSystemTask字段中的任務編號。 $ThreadID (type: integer) 事件生成器的線程標識符,如EvtSystemThreadID中所示。 $UserID (type: string) 安全標識符(SID),解析為$AccountName,存儲在EvtSystemUserID中。 $Version (type: integer) 事件在EvtSystemVersion中的版本號

表格

Event Log Severity

Normalized Severity

0/Audit Success

2/INFO

0/Audit Failure

?

4/ERROR

0/Audit Failure

?

5/CRITICAL

2/Error

?

4/ERROR

3/Warning

3/WARNING

4/Information

2/INFO

5/Verbose

1/DEBUG

?

常規nxlog.conf內容

## This is a sample configuration file. See the nxlog reference manual about the ## configuration options. It should be installed locally and is also available ## online at http://nxlog.org/docs/## Please set the ROOT to the folder your nxlog was installed into, ## otherwise it will not start.#define ROOT C:\Program Files\nxlog define ROOT C:\Program Files (x86)\nxlogModuledir %ROOT%\modules CacheDir %ROOT%\data Pidfile %ROOT%\data\nxlog.pid SpoolDir %ROOT%\data LogFile %ROOT%\data\nxlog.log<Extension _syslog>Module xm_syslog </Extension><Input in>Module im_msvistalog # For windows 2003 and earlier use the following: # Module im_mseventlog </Input><Output out>Module om_udp # 日志轉發協議Host 172.168.1.20 # 日志接收端IPPort 514 # 接收端PORTExec to_syslog_snare(); </Output><Route 1>Path in => out </Route>

?

注:以下過濾方式只適用于Module im_msvistalog,nxlog配置就不介紹了,請在nxlog正常使用的情況下使用該文檔操作

?

過濾操作:使用Exec if $xxx == xxx drop ();

通過指定regex來添加篩選器。NXLOG以NXLOG語言(在語法上與PERL非常相似)的形式提供了用戶腳本功能。為了使用regex進行篩選,我們添加了一個Exec命令,它實際上逐行遍歷輸入并執行腳本。

?

例如:濾掉raw_event字段中提到“Read”的任何事件日志,并且只針對EventID 400,那么你可以執行以下操作:

?

Exec if $EventID == 400 and ( $Message =~ /Read/m ) drop ();

例如:過濾掉包含dumpus.exe || nxlog.exe || java.exe || ...的任何事件日志,那么你可以執行以下操作:

Exec if $Message =~ /.dumpus\.exe?/ OR \$Message =~ /java\.exe?/ OR \$Message =~ /nxlog\.exe?/ drop();

?

其他條件可參照上文提供的字段編寫規則進行操作。

?

參考:https://www.rexconsulting.net/applying-double-filters-nxlog-windows-event-logs.html

參考:https://www.rexconsulting.net/adding-additional-layer-filtering-nxlog.html

參考:https://nxlog.co/question/3469/how-forward-event-ids-specific-process-names

?

?

?

?

?

總結

以上是生活随笔為你收集整理的Nxlog日志过滤的全部內容,希望文章能夠幫你解決所遇到的問題。

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