我正在尝试设置中央日志记录服务器。我正在使用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
}
}
json在logstash收到
"<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"
答案 0 :(得分:1)
查看我们的ELK-as-a-Service解决方案以及我们对nxlog的配置。
我们不使用json模块,因为nxlog json和logstash存在一些问题。我们将数据作为文本发送,并使用另一端(在服务器中)的logstash功能解析它
我很乐意帮助您解决这个问题。
(免责声明 - 我是logz.io)的副产品
这是我们使用的配置示例:
define ROOT C:\\Program Files (x86)\\nxlog
define ROOT_STRING C:\\Program Files (x86)\\nxlog
define CERTDIR %ROOT%\\cert
Moduledir %ROOT%\\modules
CacheDir %ROOT%\\data
Pidfile %ROOT%\\data\\nxlog.pid
SpoolDir %ROOT%\\data
LogFile %ROOT%\\data\\nxlog.log
<Extension charconv>
Module xm_charconv
AutodetectCharsets utf-8, euc-jp, utf-16, utf-32, iso8859-2
</Extension>
# Windows Event Log
<Input eventlog>
# Uncomment im_msvistalog for Windows Vista/2008 and later
Module im_msvistalog
#Uncomment im_mseventlog for Windows XP/2000/2003
#Module im_mseventlog
Exec if $raw_event =~ /^#/ drop();
Exec convert_fields("AUTO", "utf-8");
Exec $raw_event = '[<YOUR-TOKEN>][type=msevent]' + $raw_event;
</Input>
<Output out>
Module om_tcp
Host listener.logz.io
Port 8010
</Output>
<Route 1>
Path eventlog => out
</Route>