File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ The script is using `python3`. All dependencies can be installed with: `python3
14
14
15
15
Parameters:
16
16
* Environment variable TIMEOUT that sets the timeout in seconds for indices deletion (default: 120)
17
+ * Optional environment variable ES_USERNAME and ES_PASSWORD
17
18
* a number that will delete any indices older than that number in days
18
19
* ElasticSearch hostnames
19
20
* Example usage: ` TIMEOUT=120 ./esCleaner.py 4 localhost:9200 `
Original file line number Diff line number Diff line change @@ -15,7 +15,13 @@ def main():
15
15
print ('ARCHIVE ... specifies whether to remove archive indices. Use true or false' )
16
16
sys .exit (1 )
17
17
18
- client = elasticsearch .Elasticsearch (sys .argv [2 :])
18
+ username = os .getenv ("ES_USERNAME" )
19
+ password = os .getenv ("ES_PASSWORD" )
20
+
21
+ if username is not None and password is not None :
22
+ client = elasticsearch .Elasticsearch (sys .argv [2 :], http_auth = (username , password ))
23
+ else :
24
+ client = elasticsearch .Elasticsearch (sys .argv [2 :])
19
25
20
26
ilo = curator .IndexList (client )
21
27
empty_list (ilo , 'ElasticSearch has no indices' )
You can’t perform that action at this time.
0 commit comments