Skip to content

Instantly share code, notes, and snippets.

@ogarcia
Last active October 28, 2015 17:01
Show Gist options
  • Save ogarcia/a84ee1ef586f4d2eb9b3 to your computer and use it in GitHub Desktop.
Save ogarcia/a84ee1ef586f4d2eb9b3 to your computer and use it in GitHub Desktop.
Elasticsearch template for use with nginx logs
{
"template": "nginx-*",
"settings": {
"index.number_of_shards": "5"
},
"mappings": {
"_default_": {
"properties": {
"auth": {
"index_name": "auth",
"index": "not_analyzed",
"type": "string"
},
"response": {
"index_name": "response",
"index": "not_analyzed",
"ignore_malformed": true,
"type": "integer"
},
"httpversion": {
"index_name": "httpversion",
"index": "not_analyzed",
"ignore_malformed": true,
"type": "float"
},
"referrer": {
"index_name": "referrer",
"index": "not_analyzed",
"type": "string"
},
"clientdns": {
"index_name": "clientdns",
"index": "not_analyzed",
"type": "string"
},
"host": {
"index_name": "host",
"index": "not_analyzed",
"type": "string"
},
"bytes": {
"index_name": "bytes",
"index": "not_analyzed",
"ignore_malformed": true,
"type": "integer"
},
"clientip": {
"index_name": "clientip",
"index": "not_analyzed",
"type": "string"
},
"path": {
"index_name": "path",
"index": "analyzed",
"type": "string"
},
"geoip": {
"type": "object",
"dynamic": true,
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
}
}
@ogarcia
Copy link
Author

ogarcia commented Oct 28, 2015

To put template:

curl -XPUT localhost:9200/_template/nginx -d 'THE_JSON'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment