Skip to content

Commit

Permalink
Merge pull request #168 from logrhythm/ENG-62740-kibanaService
Browse files Browse the repository at this point in the history
Update removeOldKibanaIndices.py
  • Loading branch information
naveen-ksingh authored Dec 10, 2024
2 parents aab5f5d + 457012a commit 1caa5cf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/removeOldKibanaIndices.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
logFile = open('/var/log/probe/KibanaStartup.log', 'a')

res = requests.get('http://localhost:9200/_cat/indices/.kibana_*')
content = res.content
content = res.content.decode()
kibanaIndices = []

for indexData in content.split(" "):
Expand All @@ -12,12 +12,12 @@

kibanaIndices = sorted(kibanaIndices, key=lambda index: int(index.split("_")[1]))
kibanaIndices = kibanaIndices[:-1]
print >>logFile, "Deleting indices: {}".format(kibanaIndices)
print("Deleting indices: {}".format(kibanaIndices),file=logFile)

for index in kibanaIndices:
url = "http://localhost:9200/{}".format(index)
res = requests.delete(url)
if res.status_code != 200:
print >>logFile, "Could not delete {}".format(url)
print("Could not delete {}".format(url),file=logFile)

logFile.close()

0 comments on commit 1caa5cf

Please sign in to comment.