HUB
Sign inSign up
elasticsearch-cleaner logo

rycus86/elasticsearch-cleaner

By rycus86

•Updated over 8 years ago

Simple Go application to clean old indices from Elasticsearch

Image
0

1.8K

rycus86/elasticsearch-cleaner repository overview

⁠Elasticsearch index cleaner

Small Go application to clear old Elasticsearch indices.

⁠Motivation

As descibed on my blog⁠, if I want to keep only a certain amount of logs collected into Elasticsearch, I need to periodically delete the old indices that correspond to days too far in the past. This can be done manually with a simple curl command.

$ curl -X DELETE http://elasticsearch:9200/fluentd-20180412

⁠Usage

The application is available on Docker Hub⁠, and to run it, you can:

docker run --rm -it \
	-e BASE_URL=http://elasticsearch:9200 	\
	-e PATTERN=logstash-.* 			\
	-e MAX_INDICES=14 			\
	-e INTERVAL=12h 			\
	-e TIMEOUT=30s 				\
	rycus86/elasticsearch-cleaner

The available environment variables for the configuration are:

  • BASE_URL: The URL of the Elasticsearch server
  • PATTERN: The regular expression to look for matching indices to delete
  • MAX_INDICES: The number of (matching) indices to keep (default: 20)
  • INTERVAL: The interval between checking for old indices (default: 12h)
  • TIMEOUT: The timeout for HTTP calls to the Elasticsearch server (default: 30s)

⁠License

MIT

Tag summary
Recent tags
Content type
Image
Digest
Size
2.3 MB
Last updated
over 8 years ago
docker pull rycus86/elasticsearch-cleaner:latest