【问题标题】:LogStash extract fields from syslog messageLogStash 从系统日志消息中提取字段
【发布时间】:2018-08-31 23:48:40
【问题描述】:

就 LogStash 及其过滤机制而言,我完全是初学者。 我试过谷歌,但我似乎没有在那里得到我的问题的答案(或者我自己无法理解答案)。 我正在使用 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 作为输出。

【问题讨论】:

    标签: elasticsearch logstash kibana elastic-stack


    【解决方案1】:

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

     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" }
        }
     }
    

    这不是唯一的方法,你可以做到。 如果有帮助请告诉我,谢谢!!

    【讨论】:

      猜你喜欢
      • 2021-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多