配置文件如下:
input {
file {
path=> [ "/log/123.log" ]
codec => plain { charset => "GB2312" }
}
}
filter {
grok {
match => { "message" => "(?<date_time>^\d{6}[/-]\d{2}:\d{2}:\d{2}) %{NUMBER:accid} %{NUMBER:charid} %{WORD}:%{IPV4:client} %{WORD}:%{NUMBER:yanshi}"}
}
}
output {
elasticsearch {
hosts => "172.29.211.41"
index => "gw1704"
manage_template => true
template_name => "gw1704"
template =>"/home/ztgame/elk/logstash-2.4.1/templates/gw.json"
}
}
mapping 是复制的默认的logstash的默认的。
只更改了如下部分
{
"template" : "gw1704"
"order" : 2,
"mappings" : {
"_default_" : {
"dynamic_templates" : [ {
"message_field" : {
"match" : "message",
"match_mapping_type" : "string",
"mapping" : {
"type" : "string", "index" : "analyzed", "omit_norms" : true,
"fielddata" : { "format" : "disabled" },
"charid":{"type":"number"}, #增加部分
"client":{"type":"ip"},#增加部分
"yanshi":{"type":"number"}#增加部分
}
......
重启logstash 没有生效获取mapping 空的,然后尝试 用
curl -XPUT 172.29.211.41:9200/_template/gw1704 -d /home/ztgame/elk/logstash-2.4.1/templates/gw.json 加载
结果报错,报错信息如下:
{"error":{"root_cause":[{"type":"parse_exception","reason":"Failed to derive xcontent"}],"type":"parse_exception","reason":"Failed to derive xcontent"},"status":400}
谢谢各位了!!!这个问题卡了几天了。
input {
file {
path=> [ "/log/123.log" ]
codec => plain { charset => "GB2312" }
}
}
filter {
grok {
match => { "message" => "(?<date_time>^\d{6}[/-]\d{2}:\d{2}:\d{2}) %{NUMBER:accid} %{NUMBER:charid} %{WORD}:%{IPV4:client} %{WORD}:%{NUMBER:yanshi}"}
}
}
output {
elasticsearch {
hosts => "172.29.211.41"
index => "gw1704"
manage_template => true
template_name => "gw1704"
template =>"/home/ztgame/elk/logstash-2.4.1/templates/gw.json"
}
}
mapping 是复制的默认的logstash的默认的。
只更改了如下部分
{
"template" : "gw1704"
"order" : 2,
"mappings" : {
"_default_" : {
"dynamic_templates" : [ {
"message_field" : {
"match" : "message",
"match_mapping_type" : "string",
"mapping" : {
"type" : "string", "index" : "analyzed", "omit_norms" : true,
"fielddata" : { "format" : "disabled" },
"charid":{"type":"number"}, #增加部分
"client":{"type":"ip"},#增加部分
"yanshi":{"type":"number"}#增加部分
}
......
重启logstash 没有生效获取mapping 空的,然后尝试 用
curl -XPUT 172.29.211.41:9200/_template/gw1704 -d /home/ztgame/elk/logstash-2.4.1/templates/gw.json 加载
结果报错,报错信息如下:
{"error":{"root_cause":[{"type":"parse_exception","reason":"Failed to derive xcontent"}],"type":"parse_exception","reason":"Failed to derive xcontent"},"status":400}
谢谢各位了!!!这个问题卡了几天了。
2 个回复
jiakechong1642
赞同来自:
jiakechong1642
赞同来自: