[英]ElasticSearch - Unable to fetch mapping
我已经建立了一个ELK堆栈来索引我的Akamai日志。 我已经在Logstash中创建了一个conf文件,并且在加载Logstash时正在加载它。 我的日志文件只是读取
管道主线开工
但是,我无法在Kibana中创建索引。 我看到讯息
无法获取映射
我通过调试器运行了grok语句,似乎我捕获了所有内容。 这是我的配置:
input {
file {
path => "C:\Akamai_Logs\US\*"
start_position => "beginning"
}
}
filter {
grok {
match => ["message", "%{DATE:date} %{TIME:time} %{IP:client} %{WORD:method} %{URIPATH:URI} %{NUMBER:status} %{NUMBER:bytes} %{NUMBER:time_taken} %{NOTSPACE:refererr} %{QS:user_agent} %{GREEDYDATA:cookie}"]
}
}
output {
stdout {codec => rubydebug}
elasticsearch {
hosts => ["localhost:9200"]
}
}
这是其中一个日志的示例行
2016-06-14 14:03:42 1.1.1.1 GET / origin-uri 200 26222 0“引荐来源网址”“用户代理”“ cookie字符串”
日志文件中的间距可能导致索引编制问题吗? 我只是想念其他东西吗?
编辑:忘记添加我的Logstash模板
{
"template": "logstash-*",
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"index" : {
"query" : { "default_field" : "@message" },
"store" : { "compress" : { "stored" : true, "tv": true } }
}
},
"mappings": {
"_default_": {
"_all": { "enabled": false },
"_source": { "compress": true },
"dynamic_templates": [
{
"string_template" : {
"match" : "*",
"mapping": { "type": "string", "index": "not_analyzed" },
"match_mapping_type" : "string"
}
}
],
"properties" : {
"@date": { "type": "date", "format": "yyyy-MM-dd" },
"@time": { "type": "time", "format": "hh:mm:ss" },
"@hostip": {"type": "string","index" : "not_analyzed"},
"@method": {"type": "string","index" : "not_analyzed"},
"@page": {"type": "string","index" : "not_analyzed"},
"@status": {"type": "integer"},
"@bytes": {"type": "integer"},
"@timetaken": {"type": "integer"},
"@referrer": {"type": "string","index" : "not_analyzed"},
"@useragent": {"type": "string","index" : "not_analyzed"},
"@cookie": {"type": "string","index" : "not_analyzed"}
}
}
}
}
用这一行替换您的file
输入(使用正斜杠而不是反斜杠),然后它应该可以工作。
input {
file {
path => "C:/Akamai_Logs/US/*.*"
start_position => "beginning"
}
}
更新
由于您拥有自己的索引模板文件,因此请确保按以下方式修改您的elasticsearch
输出:
output {
elasticsearch {
hosts => ["localhost:9200"]
template => "/path/to/logstash-template.json"
template_overwrite => true
}
}
如果您的ES中已经存在一个logstash模板,也可以确保删除它
curl -XDELETE localhost:9200/_template/logstash
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.