kibana和suricata json过滤没有显示正确

时间:2015-04-09 14:42:31

标签: logging logstash kibana kibana-4

我有一个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配置文件已设置如下

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

1 个答案:

答案 0 :(得分:0)

我想通过将codec => json添加到lumberjack的主输入

来解决这个问题