From 16ddc860f9cc74ceea9fe4520602995e2edddf4c Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Zaib Date: Mon, 21 May 2018 23:36:37 +0500 Subject: [PATCH 1/5] Update backup directory on instance. Directory path with '-' doesnt work --- elasticsearch/elasticsearch.service | 2 +- filebeat/filebeat.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/elasticsearch/elasticsearch.service b/elasticsearch/elasticsearch.service index dd3d71a..e6bc0af 100644 --- a/elasticsearch/elasticsearch.service +++ b/elasticsearch/elasticsearch.service @@ -12,7 +12,7 @@ ExecStart=/usr/bin/sh -c "/usr/bin/docker run --rm --name %n \ -p 9200:9200 -p 9300:9300 \ --dns=${IPV4} \ --dns-search=service.consul \ - -v /docker-data/esdata:/usr/share/elasticsearch/data \ + -v /data/docker/elasticsearch:/usr/share/elasticsearch/data \ --label SERVICE_NAME=elasticsearch \ --label SERVICE_TAGS=infra-app \ stakater/elasticsearch:5.2" diff --git a/filebeat/filebeat.service b/filebeat/filebeat.service index 6592496..ea17c5d 100644 --- a/filebeat/filebeat.service +++ b/filebeat/filebeat.service @@ -11,7 +11,7 @@ ExecStart=/usr/bin/sh -c "/usr/bin/docker run --rm --name %n \ --dns=${IPV4} \ --dns-search=service.consul \ -v /data/logs:/var/log/app \ - -v /docker-data/filebeat/:/filebeat-data \ + -v /data/docker/filebeat/:/filebeat-data \ -v /admiral-config/filebeat/consul-templates:/templates \ -e SERVICE_NAME=filebeat \ stakater/filebeat-with-consul-template:5.2-0.18.0" From fdcadf56a13142999be7eec770d14efb9bec21dc Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Zaib Date: Fri, 25 May 2018 10:21:17 +0500 Subject: [PATCH 2/5] Add dependency on logstash for filebeat. --- filebeat/filebeat.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/filebeat/filebeat.service b/filebeat/filebeat.service index ea17c5d..cfbfcf7 100644 --- a/filebeat/filebeat.service +++ b/filebeat/filebeat.service @@ -1,7 +1,7 @@ [Unit] Description=Filebeat service, for beating logs and sending them to Logstash -After=docker.service consul-agent.service -Requires=docker.service consul-agent.service +After=docker.service consul-agent.service logstash.service +Requires=docker.service consul-agent.service logstash.service [Service] ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment IPV4=$(curl http://169.254.169.254/latest/meta-data/local-ipv4)" From 37e67d723e42564f8c320f1eb366ab1539af1a5f Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Zaib Date: Tue, 29 May 2018 14:22:48 +0500 Subject: [PATCH 3/5] Use correct name of logstash service in filebeat template --- filebeat/consul-templates/filebeat.ctmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filebeat/consul-templates/filebeat.ctmpl b/filebeat/consul-templates/filebeat.ctmpl index a86ffaa..88226ae 100644 --- a/filebeat/consul-templates/filebeat.ctmpl +++ b/filebeat/consul-templates/filebeat.ctmpl @@ -281,7 +281,7 @@ output: ### Logstash as output logstash: # The Logstash hosts - hosts: [{{range $index, $service := service "logstash"}}{{if ne $index 0}},{{end}}"{{.Address}}:{{.Port}}"{{end}}] + hosts: [{{range $index, $service := service "logstash-5044"}}{{if ne $index 0}},{{end}}"{{.Address}}:{{.Port}}"{{end}}] # Number of workers per Logstash host. #worker: 1 From 7c834ef00e9a7d1612e5643a31bb2443aca2620a Mon Sep 17 00:00:00 2001 From: Muhammad Hamza Zaib Date: Tue, 29 May 2018 14:29:16 +0500 Subject: [PATCH 4/5] Change volume directory of filebeat + elasticsearch --- elasticsearch/elasticsearch.service | 2 +- filebeat/filebeat.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/elasticsearch/elasticsearch.service b/elasticsearch/elasticsearch.service index e6bc0af..1581e0d 100644 --- a/elasticsearch/elasticsearch.service +++ b/elasticsearch/elasticsearch.service @@ -12,7 +12,7 @@ ExecStart=/usr/bin/sh -c "/usr/bin/docker run --rm --name %n \ -p 9200:9200 -p 9300:9300 \ --dns=${IPV4} \ --dns-search=service.consul \ - -v /data/docker/elasticsearch:/usr/share/elasticsearch/data \ + -v /docker-data/elasticsearch:/usr/share/elasticsearch/data \ --label SERVICE_NAME=elasticsearch \ --label SERVICE_TAGS=infra-app \ stakater/elasticsearch:5.2" diff --git a/filebeat/filebeat.service b/filebeat/filebeat.service index cfbfcf7..10b631d 100644 --- a/filebeat/filebeat.service +++ b/filebeat/filebeat.service @@ -11,7 +11,7 @@ ExecStart=/usr/bin/sh -c "/usr/bin/docker run --rm --name %n \ --dns=${IPV4} \ --dns-search=service.consul \ -v /data/logs:/var/log/app \ - -v /data/docker/filebeat/:/filebeat-data \ + -v /docker-data/filebeat/:/filebeat-data \ -v /admiral-config/filebeat/consul-templates:/templates \ -e SERVICE_NAME=filebeat \ stakater/filebeat-with-consul-template:5.2-0.18.0" From a5565315348526d3cf9c98bd678cdd23350de5c4 Mon Sep 17 00:00:00 2001 From: hamza3202 Date: Thu, 31 May 2018 11:34:12 +0500 Subject: [PATCH 5/5] Update curator version and elastic search URL --- curator/curator.service | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/curator/curator.service b/curator/curator.service index 4228dde..0f461c5 100644 --- a/curator/curator.service +++ b/curator/curator.service @@ -5,20 +5,20 @@ Requires=docker.service consul-agent.service elasticsearch.service [Service] ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment IPV4=$(curl http://169.254.169.254/latest/meta-data/local-ipv4)" -ExecStartPre=/usr/bin/docker pull stakater/elasticsearch-curator:3.5.1 +ExecStartPre=/usr/bin/docker pull stakater/elasticsearch-curator:5.5.4 ExecStartPre=-/usr/bin/docker rm %n ExecStart=/usr/bin/sh -c "/usr/bin/docker run --rm --name %n \ --dns=${IPV4} \ --dns-search=service.consul \ - -e ELASTICSEARCH_HOST=elasticsearch \ + -e ELASTICSEARCH_HOST=elasticsearch-9200 \ -e ELASTICSEARCH_PORT=9200 \ -e OLDER_THAN=6 \ -e TIME_UNIT=months \ -e DO_SNAPSHOT='' \ - stakater/elasticsearch-curator:3.5.1" + stakater/elasticsearch-curator:5.5.4" ExecStop=/usr/bin/docker stop %n RestartSec=10 Restart=always [X-Fleet] -Global=true \ No newline at end of file +Global=true