Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Add logstash index cleaning. Defaults to 128gb data max. Using https:…
Browse files Browse the repository at this point in the history
…//github.com/logstash/expire-logs. Splitted out elasticsearch servers.
  • Loading branch information
analytically committed Jan 4, 2014
1 parent 26506c1 commit 8c4145b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
3 changes: 3 additions & 0 deletions hosts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ namenodes
[regionservers:children]
datanodes

[elasticsearch]
monitor01

[monitors]
monitor01

Expand Down
4 changes: 4 additions & 0 deletions roles/logstash_index_cleaner/defaults/main.yml
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
18 changes: 18 additions & 0 deletions roles/logstash_index_cleaner/tasks/main.yml
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
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 }}
9 changes: 8 additions & 1 deletion site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
roles:
- { role: 2_aggregated_links, when: bond_mode is defined and mtu is defined and ansible_virtualization_role == "host" and ansible_interfaces|length == 3 and "bond0" not in ansible_interfaces }

- hosts: elasticsearch
accelerate: "{{ accelerate }}"
user: ansibler
sudo: true
roles:
- elasticsearch

- hosts: monitors[0]
accelerate: "{{ accelerate }}"
user: ansibler
Expand All @@ -26,7 +33,7 @@
- oracle_jdk
- ganglia_metad
- ganglia_web
- elasticsearch
- logstash_index_cleaner
- kibana3

- hosts: all
Expand Down

0 comments on commit 8c4145b

Please sign in to comment.