Skip to content

Instantly share code, notes, and snippets.

@sebnmuller
Created December 13, 2016 20:09
Show Gist options
  • Save sebnmuller/14e53753a2c04e0630c35f7617501a14 to your computer and use it in GitHub Desktop.
Save sebnmuller/14e53753a2c04e0630c35f7617501a14 to your computer and use it in GitHub Desktop.
Logstash Elasticsearch Template
input {
file {
path => "/Users/sebastienmuller/dev/elastic/5/logstash-5.0.2/bin/produkter.csv"
start_position => "beginning"
sincedb_path => "/dev/null"
codec => plain { charset => "ISO-8859-1" }
}
#stdin {}
}
filter {
csv {
autogenerate_column_names => false
separator => ";"
columns => ["Datotid","Varenummer","Varenavn","Volum","Pris","Literpris","Varetype","Produktutvalg","Butikkategori","Fylde","Friskhet","Garvestoffer","Bitterhet","Sodme","Farge","Lukt","Smak","Passertil01","Passertil02","Passertil03","Land","Distrikt","Underdistrikt","Argang","Rastoff","Metode","Alkohol","Sukker","Syre","Lagringsgrad","Produsent","Grossist","Distributor","Emballasjetype","Korktype",Vareurl]
}
mutate {
convert => { "Literpris" => "float" }
convert => { "Alkohol" => "float" }
}
}
output {
stdout {
codec => rubydebug
}
elasticsearch {
hosts => [ "188.166.1.221:49200" ]
template => "/Users/sebastienmuller/dev/elastic/5/logstash-5.0.2/bin/template.json"
template_overwrite => true
index => "test"
}
}
{
"template" : "unique index name goes here",
"settings" : {
"index.refresh_interval" : "5s"
},
"mappings" : {
"_default_" : {
"_all" : {"enabled" : true},
"dynamic_templates" : [ {
"string_fields" : {
"match" : "*",
"match_mapping_type" : "string",
"mapping" : {
"type" : "string", "index" : "analyzed", "omit_norms" : true,
"fields" : {
"raw" : {"type": "keyword", "ignore_above" : 256}
}
}
}
} ],
"properties" : {
"@version": { "type": "keyword" },
"Literpris": { "type": "float" },
"Alkohol": { "type": "float" }
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment