0

我有一个 ELK 堆栈正在运行,并且刚刚在上面放了一些 suricata

我认为我已正确设置它,因为它正在将日志从主机发送到 ELK 服务器

在 kibana 中,我可以看到 eve.json 文件并查看数据,但我似乎无法正确格式化它,因为所有重要信息都存储在消息字段中。我以为我可以像其他领域一样在 kibana 中很好地过滤它?

还是我错过了什么?

{
  "_index": "logstash-2015.04.09",
  "_type": "suricata",
  "_id": "",
  "_score": null,
  "_source": {
    "message": "{\"timestamp\":\"2015-04-09T14:33:43.585096\",\"event_type\":\"alert\",\"src_ip\":\"x.x.x.x\",\"src_port\":40238,\"dest_ip\":\"x.x.x.x\",\"dest_port\":443,\"proto\":\"TCP\",\"alert\":{\"action\":\"allowed\",\"gid\":1,\"signature_id\":2402000,\"rev\":3672,\"signature\":\"ET DROP Dshield Block Listed Source group 1\",\"category\":\"Misc Attack\",\"severity\":2}}",
    "@version": "1",
    "@timestamp": "2015-04-09T13:33:41.389Z",
    "type": "suricata",
    "file": "/var/log/suricata/eve.json",
    "host": "xx",
    "offset": "51171"
  },
  "fields": {
    "@timestamp": [
      1428586421389
    ]
  },
  "highlight": {
    "message": [
      "{\"timestamp\":\"2015-04-09T14:33:43.585096\",\"event_type\":\"@kibana-highlighted-field@alert@/kibana-highlighted-field@\",\"src_ip\":\"x.x.x.x\",\"src_port",
      "\":40238,\"dest_ip\":\"x.x.x.x\",\"dest_port\":443,\"proto\":\"TCP\",\"@kibana-highlighted-field@alert@/kibana-highlighted-field@\":{\"action\":\"allowed\",\"gid\":1"
    ]
  },
  "sort": [
    1428586421389
  ]
}

logstash conf文件已设置为这样

filter {
  if [type] == "SuricataIDPS" {
    date {
      match => [ "timestamp", "ISO8601" ]
    }
    ruby {
      code => "if event['event_type'] == 'fileinfo'; event['fileinfo']['type']=event['fileinfo']['magic'].to_s.split(',')[0]; end;"
    }
  }

  if [src_ip]  {
    geoip {
      source => "src_ip"
      target => "geoip"
      #database => "/opt/logstash/vendor/geoip/GeoLiteCity.dat"
      add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ]
      add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}"  ]
    }
    mutate {
      convert => [ "[geoip][coordinates]", "float" ]
    }
    if ![geoip.ip] {
      if [dest_ip]  {
        geoip {
          source => "dest_ip"
          target => "geoip"
          #database => "/opt/logstash/vendor/geoip/GeoLiteCity.dat"
          add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ]
          add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}"  ]
        }
        mutate {
          convert => [ "[geoip][coordinates]", "float" ]
        }
      }
    }
  }
}
4

1 回答 1

0

我想我通过添加 codec => json到伐木工人的主要输入来解决这个问题

于 2015-04-10T13:34:54.100 回答