如何在Kibana中否定过滤器查询

时间:2016-09-27 14:53:48

标签: json elasticsearch kibana

我正在使用ELK堆栈,我正在尝试查找除了特定IP范围(例如10.0.0.0/8)之外的所有日志的可视化。有没有办法如何否定过滤查询:

{"wildcard":{"src_address":"10.*"}}

我把它放到了Buckets - >分裂条 - >聚合 - >过滤器,我想否定这个查询,所以我得到了除10.0.0.0/8

以外的所有日志

这是整个JSON请求:

    {
      "query": {
        "filtered": {
          "query": {
            "query_string": {
              "query": "low_level_category:\"user_authentication_failure\" AND NOT src_address:\"10.*\"",
              "analyze_wildcard": true
            }
          },
          "filter": {
            "bool": {
              "must": [
                {
                  "range": {
                    "@timestamp": {
                      "gte": 1474384885044,
                      "lte": 1474989685044,
                      "format": "epoch_millis"
                    }
                  }
                }
              ],
              "must_not": []
            }
          }
        }
      },
      "size": 0,
      "aggs": {
        "2": {
          "date_histogram": {
            "field": "@timestamp",
            "interval": "3h",
            "time_zone": "Europe/Berlin",
            "min_doc_count": 200,
            "extended_bounds": {
              "min": 1474384885043,
              "max": 1474989685043
            }
          },
          "aggs": {
            "3": {
              "terms": {
                "field": "src_address.raw",
                "size": 5,
                "order": {
                  "_count": "desc"
                }
              }
            }
          }
        }
      }
    }

由于

1 个答案:

答案 0 :(得分:12)

您可以在Kibana搜索框中输入此内容,它可以满足您的需求:

NOT src_address:10.*