Skip to content

A simple Elasticsearch cleaner based on a Python script to clean up all indices and data streams from the Elasticsearch cluster which are older than the specified number of days.

License

Notifications You must be signed in to change notification settings

abdullahkhawer/simple-elasticsearch-cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Elasticsearch Cleaner

Introduction

A simple Elasticsearch cleaner based on a Python script to clean up all indices and data streams from the Elasticsearch cluster which are older than the specified number of days.

Usage Notes

Prerequisites

Following are the prerequisites to be met once before you begin:

  • Following packages should be installed on your system:
    • pip
    • python
    • elasticsearch
      • Using pip

Execution Instructions

Once all the prerequisites are met, set the following environment variables:

  • ELASTICSEARCH_HOST
    • Description: Host of Elasticsearch cluster.
    • Example: https://localhost
    • Requirement: REQUIRED
  • ELASTICSEARCH_PORT
    • Description: Port of Elasticsearch cluster.
    • Example: 9200
    • Requirement: REQUIRED
  • ELASTICSEARCH_USER
    • Description: Username of the Elasticsearch cluster.
    • Example: admin
    • Requirement: REQUIRED
  • ELASTICSEARCH_PASSWORD
    • Description: Password of the user of the Elasticsearch cluster.
    • Example: 123456789
    • Requirement: REQUIRED

And then simply run the following command:

  • python simple_elasticsearch_cleaner.py NUMBER_OF_DAYS
    • Example: python simple_elasticsearch_cleaner.py 30

Any contributions, improvements and suggestions will be highly appreciated. 😊