Hi,
I am trying to put a .csv
file in to logstash and then get the index to kibana. When a dynamic mapping is given and run logstash. It works fine and Kibana shows the index. Following is the config
file and the dynamic mapping created by logstash
.
`input {
file {
path => "D:\Projects\A\Installations\logstash\logstash-2.3.4\bin\code.txt"
start_position => beginning
}
}
filter {
csv {
columns => [
"A",
"B",
"C",
"D"
]
separator => ","
}
mutate{
convert => {
"B" => "integer"
"C" => "integer"
"D" => "integer"
}
}
}
output {
elasticsearch {
hosts=>["localhost:9200"]
index => "report"
document_id => "%{A}"
}
stdout { codec => rubydebug }
}
The dynamic mapping at the elasticsearche's side.
"report" : {
"mappings" : {
"logs" : {
"properties" : {
"@timestamp" : {
"type" : "date",
"format" : "strict_date_optional_time||epoch_millis"
},
"@version" : {
"type" : "string"
},
"A" : {
"type" : "string"
},
"B" : {
"type" : "long"
},
"C" : {
"type" : "long"
},
"D" : {
"type" : "long"
},
"host" : {
"type" : "string"
},
"message" : {
"type" : "string"
},
"path" : {
"type" : "string"
}
}
}
}
}
}
However, once I create custom mapping (shown below) and try to upload the documents, Its not accepted by elastic search. Following is the mapping I have created.
curl -XPUT 'http://localhost:9200/test_coverage/' -d '{
"settings" : {
"index" : {
"number_of_shards" : 3,
"number_of_replicas" : 2
}} ,
"mappings": {
"logs": {
"properties" : {
"A": {"type": "string","index": "not_analyzed"},
"B": {"type": "integer"},
"C": {"type": "integer"},
"D": {"type": "integer"}
}
}
}
}'
I have following questions,
- Do I need to add meta fields (@timestamp, @version..etc) to the custom mapping I am creating in elasticsearch?
- Dynamic mapping actually identifies
long
for fields butinteger
is adequate. Cant I force it to useinteger
s ? - Once I delete a document in the log file, it seems like that change is not reflected in the elasticsearche's index. Is there any way to configure it through the logstash configuration file or have to manually remove the doument via an external script.
I have following versions of the elk stack and I am working on Windows 7 64 bit.
Kibana 4.5.2
Logstash 2.3.4
Elastic Search 2.3.4
Thank You!