This repository has been archived by the owner on May 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logstash index cleaning. Defaults to 128gb data max. Using https:…
…//github.com/logstash/expire-logs. Splitted out elasticsearch servers.
- Loading branch information
1 parent
26506c1
commit 8c4145b
Showing
5 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,9 @@ namenodes | |
[regionservers:children] | ||
datanodes | ||
|
||
[elasticsearch] | ||
monitor01 | ||
|
||
[monitors] | ||
monitor01 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
|
||
# maximum logstash data size in elasticsearch, defaults to 128 gb | ||
logstash_max_data_gb: 128 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
# file: roles/logstash_index_cleaner/tasks/main.yml | ||
|
||
- name: install python-pip via apt | ||
apt: pkg=python-pip | ||
tags: logstash_index_cleaner | ||
|
||
- name: clone the expire-logs repo to /var/lib/logstash-index-cleaner | ||
git: repo=https://github.com/logstash/expire-logs.git dest=/var/lib/logstash-index-cleaner update=true | ||
tags: logstash_index_cleaner | ||
|
||
- name: pip install -r requirements.txt | ||
shell: chdir=/var/lib/logstash-index-cleaner pip install -r requirements.txt | ||
tags: logstash_index_cleaner | ||
|
||
- name: install the logstash index cleaner crontab at /etc/cron.d/logstash-index-cleaner | ||
template: src=logstash-index-cleaner.cron.d dest=/etc/cron.d/logstash-index-cleaner owner=root group=root mode=644 | ||
tags: logstash_index_cleaner |
1 change: 1 addition & 0 deletions
1
roles/logstash_index_cleaner/templates/logstash-index-cleaner.cron.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 2 * * * * root python /var/lib/logstash-index-cleaner/logstash_index_cleaner.py --host {{ hostvars[groups["elasticsearch"][0]]["ansible_hostname"] }} -g {{ logstash_max_data_gb }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters