gpt4 book ai didi

elasticsearch - 如何在ElasticSearch/Kibana中精确搜索URL

转载 作者:行者123 更新时间:2023-12-03 02:05:47 31 4
gpt4 key购买 nike

我已导入IIS日志文件,并且数据已通过Logstash(1.4.2)移动到ElasticSearch(1.3.1)中,然后在Kibana中显示。

我的过滤器部分如下:

filter {
grok {
match =>
["message" , "%{TIMESTAMP_ISO8601:iisTimestamp} %{IP:serverIP} %{WORD:method} %{URIPATH:uri} - %{NUMBER:port} - %{IP:clientIP} - %{NUMBER:status} %{NUMBER:subStatus} %{NUMBER:win32Status} %{NUMBER:timeTaken}"]
}
}

在Kibana中使用“术语”面板并使用“uri”(我从Logstash捕获的字段之一)时,它与URI中的标记匹配。因此,它与以下项匹配:
  • '脚本'
  • '/'
  • 'EN

  • 问:如何完整显示“热门URL”?

    问:如何通知ElasticSearch该字段为'not_analysed'。我不介意有2个字段,例如:
  • uri-带标记的URI
  • uri.raw-完整的URL。

  • 可以在Logstash端完成此操作,还是需要在ElasticSearch中设置映射?

    映射如下:
    //http://localhost:9200/iislog-2014.10.09/_mapping?pretty

    {
    "iislog-2014.10.09" : {
    "mappings" : {
    "iislogs" : {
    "properties" : {
    "@timestamp" : {
    "type" : "date",
    "format" : "dateOptionalTime"
    },
    "@version" : {
    "type" : "string"
    },
    "clientIP" : {
    "type" : "string"
    },
    "device" : {
    "type" : "string"
    },
    "host" : {
    "type" : "string"
    },
    "id" : {
    "type" : "string"
    },
    "iisTimestamp" : {
    "type" : "string"
    },
    "logFilePath" : {
    "type" : "string"
    },
    "message" : {
    "type" : "string"
    },
    "method" : {
    "type" : "string"
    },
    "name" : {
    "type" : "string"
    },
    "os" : {
    "type" : "string"
    },
    "os_name" : {
    "type" : "string"
    },
    "port" : {
    "type" : "string"
    },
    "serverIP" : {
    "type" : "string"
    },
    "status" : {
    "type" : "string"
    },
    "subStatus" : {
    "type" : "string"
    },
    "tags" : {
    "type" : "string"
    },
    "timeTaken" : {
    "type" : "string"
    },
    "type" : {
    "type" : "string"
    },
    "uri" : {
    "type" : "string"
    },
    "win32Status" : {
    "type" : "string"
    }
    }
    }
    }
    }
    }

    最佳答案

    在您的Elasticsearch映射中:

    url: {
    type: "string",
    index: "not_analyzed"
    }

    关于elasticsearch - 如何在ElasticSearch/Kibana中精确搜索URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26357736/

    31 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com