我正在尝试建立一个中央日志服务器。我正在使用 nxlog 将窗口的安全事件发送到运行 elasticsearch logstash 和 kibana 的 ubuntu 服务器,但是 nxlog 输出的日志文件看起来不正确,因为 logstash 无法粘贴任何数据,它只是将其全部放入“消息”中。我正在使用 Windows 8(很快会更新到 10)并且想知道我需要做什么来解析数据。我试过 grok,但有些字段是空白的,日志中还有 2 个日期/时间。
*注意我在谷歌上搜索并尝试了其他人的建议,但日志总是一样的。即使我尝试将其导出为 XML 而不是 JSON。
nxlog.conf
#define ROOT C:\Program Files\nxlog
define ROOT C:\Program Files (x86)\nxlog
Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
LogFile %ROOT%\data\nxlog.log
<Extension syslog>
Module xm_syslog
</Extension>
<Extension json>
Module xm_json
</Extension>
<Input in>
Module im_msvistalog
Query <QueryList> \
<Query Id="0"> \
# <Select Path="Microsoft-Windows-Sysmon/Operational">*</Select> \
# <Select Path="Application">*</Select> \
# <Select Path="System">*</Select> \
<Select Path="Security">*</Select> \
</Query> \
</QueryList>
Exec $Message = to_json(); to_syslog_bsd();
</Input>
<Output out>
Module om_tcp
Host XXX.XXX.XXX.XXX
Port 9999
</Output>
<Route 1>
Path in => out
</Route>
logstash.conf
input {
tcp {
port => 9999
codec => json
tags => ["windows","eventlog"]
type => 'nxlog-json'
}
}
output {
elasticsearch {
host => localhost
}
}
在logstash收到的json
"<5>Aug 12 15:45:06 JOE>SMITH.com MSWinEventLog\t5\tSecurity\t1319\tWed Aug 12 15:45:03 2015\t4779\tMicrosoft-Windows-Security-Auditing\t\tN/A\tAudit Success\tJOE.SMITH.com\t12551\tA session was disconnected from a Window Station.\r\n\r\nSubject:\r\n\tAccount Name:\t\tnoob.jwsmith\r\n\tAccount Domain:\t\tITORG\r\n\tLogon ID:\t\t0x151258A\r\n\r\nSession:\r\n\tSession Name:\t\tRDP-Tcp#66\r\n\r\nAdditional Information:\r\n\tClient Name:\t\tJOESMITH\r\n\tClient Address:\t\tXXX.XXX.XXX.XXX\r\n\r\n\r\nThis event is generated when a user disconnects from an existing Terminal Services session, or when a user switches away from an existing desktop using Fast User Switching.\n"