繁体   English   中英

LogStash从syslog消息中提取字段

[英]LogStash extract fields from syslog message

对于LogStash及其过滤机制,我是一个完全的初学者。 我已经尝试过google,但在那儿似乎找不到我的问题的答案(或者我自己听不懂答案)。 我正在使用syslog代理(WinCollect)将数据发送到LogStash,但是在Kibana中,我希望基于syslog“消息”部分具有多个可视化字段。 例如,此消息:

AgentDevice=WindowsLog  AgentLogFile=Security   PluginVersion=7.2.5.27  Source=Microsoft-Windows-Security-Auditing  Computer=domaincontroller1.contoso.com  OriginatingComputer=127.0.0.1   User=   Domain= EventID=4624    EventIDCode=4624    EventType=8 EventCategory=12544 RecordNumber=595555663  TimeGenerated=1521725859    TimeWritten=1521725859  Level=0 Keywords=0  Task=0  Opcode=0    Message=An account was successfully logged on. Subject: Security ID: NULL SID Account Name: - Account Domain: - Logon ID: 0x0 Logon Type: 3 New Logon: Security ID: CONTOSO\u0111 Account Name: u0111 Account Domain: CONTOSO Logon ID: 0x2a376541 Logon GUID: {300CFB3A-32CF-8207-48C5-00000000000} Process Information: Process ID: 0x0 Process Name: - Network Information: Workstation Name: - Source Network Address: 10.0.0.1 Source Port: 55123 Detailed Authentication Information: Logon Process: Kerberos Authentication Package: Kerberos Transited Services: - Package Name (NTLM only): - Key Length: 0 This event is generated when a logon session is created. It is generated on the computer that was accessed. The subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe. The logon type field indicates the kind of logon that occurred. The most common types are 2 (interactive) and 3 (network). The New Logon fields indicate the account for whom the new logon was created, i.e. the account that was logged on. The network fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases. The authentication information fields provide detailed information about this specific logon request. - Logon GUID is a unique identifier that can be used to correlate this event with a KDC event. - Transited services indicate which intermediate services have participated in this logon request. - Package name indicates which sub-protocol was used among the NTLM protocols. - Key length indicates the length of the generated session key. This will be 0 if no session key was requested.

如果我想根据此消息将“ EventID”和“计算机”作为kibana中的字段,我将如何设置我的grok过滤器? 对不起,当前的grok过滤器没有代码,因为它们都不起作用,我的配置非常简单,仅以syslog作为输入,而elasticsearch作为输出。

我将直接从您的过滤器部分开始

 filter {
    grok {
      match => ["message","Computer=%{NOTSPACE:computer}"]
    }
    grok {
      match => ["message", "EventID=%{INT:event_id}"]
    }
    # if you might want to drop other data
    mutate {
      remove_field => ["message"]
      convert => { "event_id" => "integer" }
    }
 }

这不是唯一的方法,您可以做到。 让我知道是否有帮助,谢谢!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM