From 73de2d68d41947df9f7f5e93185eee87c8b2e118 Mon Sep 17 00:00:00 2001 From: Joshua Carp Date: Mon, 24 Jul 2017 02:19:34 -0400 Subject: [PATCH 01/19] Drop default cerebro secret. (#85) * Drop default cerebro secret. * Add cerebro secret to manifest templates. --- deployment/logsearch-deployment.yml | 5 +++++ jobs/cerebro/spec | 1 - jobs/cerebro/templates/config/application.conf.erb | 1 - templates/logsearch-jobs.yml | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deployment/logsearch-deployment.yml b/deployment/logsearch-deployment.yml index 04547b65..7865c686 100644 --- a/deployment/logsearch-deployment.yml +++ b/deployment/logsearch-deployment.yml @@ -96,6 +96,9 @@ instance_groups: release: logsearch consumes: elasticsearch: {from: elasticsearch_master} + properties: + cerebro: + secret: ((cerebro_secret_key)) - name: syslog_forwarder release: logsearch consumes: @@ -401,6 +404,8 @@ variables: type: password - name: firehose_client_secret type: password +- name: cerebro_secret_key + type: password releases: - name: logsearch diff --git a/jobs/cerebro/spec b/jobs/cerebro/spec index 6a4eb673..3c4e205d 100644 --- a/jobs/cerebro/spec +++ b/jobs/cerebro/spec @@ -27,4 +27,3 @@ properties: default: [] cerebro.secret: description: Secret will be used to sign Cerebro session cookies and CSRF tokens. - default: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" diff --git a/jobs/cerebro/templates/config/application.conf.erb b/jobs/cerebro/templates/config/application.conf.erb index 470e3611..9f3e95bf 100644 --- a/jobs/cerebro/templates/config/application.conf.erb +++ b/jobs/cerebro/templates/config/application.conf.erb @@ -1,5 +1,4 @@ # Secret will be used to sign session cookies, CSRF tokens and for other encryption utilities. -# It is highly recommended to change this value before running cerebro in production. secret = "<%= p("cerebro.secret") %>" # Application base path diff --git a/templates/logsearch-jobs.yml b/templates/logsearch-jobs.yml index 586bd62d..708035d4 100644 --- a/templates/logsearch-jobs.yml +++ b/templates/logsearch-jobs.yml @@ -22,6 +22,8 @@ jobs: node: allow_master: true allow_data: false + cerebro: + secret: (( param "specify cerebro secret key" )) syslog_forwarder: config: - {service: elasticsearch, file: /var/vcap/sys/log/elasticsearch/elasticsearch.stdout.log} From 681a8f2429831e8647651f41d336e678906efe63 Mon Sep 17 00:00:00 2001 From: Andrei Krasnitski Date: Mon, 24 Jul 2017 21:36:46 +0300 Subject: [PATCH 02/19] Provide syslog.transport property via link --- jobs/ingestor_syslog/spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jobs/ingestor_syslog/spec b/jobs/ingestor_syslog/spec index 284c2ff4..ad65b943 100644 --- a/jobs/ingestor_syslog/spec +++ b/jobs/ingestor_syslog/spec @@ -25,6 +25,7 @@ provides: type: ingestor properties: - logstash_ingestor.syslog.port + - logstash_ingestor.syslog.transport - logstash_ingestor.syslog_tls.port - logstash_ingestor.relp.port - name: syslog_forwarder @@ -88,6 +89,9 @@ properties: logstash_ingestor.syslog.port: description: Port to listen for syslog messages default: 5514 + logstash_ingestor.syslog.transport: + description: Transport protocol to use + default: "tcp" logstash_ingestor.syslog_tls.port: description: Port to listen for syslog-TLS messages (omit to disable) From 1bc4245610162d07999314b88b49e2a4f3bc2889 Mon Sep 17 00:00:00 2001 From: Andrei Krasnitski Date: Tue, 25 Jul 2017 14:53:53 +0300 Subject: [PATCH 03/19] Allow to set environment variables in syslog_ctl script --- jobs/ingestor_syslog/spec | 3 +++ jobs/ingestor_syslog/templates/bin/ingestor_syslog_ctl | 3 +++ 2 files changed, 6 insertions(+) diff --git a/jobs/ingestor_syslog/spec b/jobs/ingestor_syslog/spec index ad65b943..8b2f115e 100644 --- a/jobs/ingestor_syslog/spec +++ b/jobs/ingestor_syslog/spec @@ -47,6 +47,9 @@ properties: example: - {name: logstash-output-cloudwatchlogs, version: 2.0.0} default: [] + logstash.env: + description: "a list of arbitrary key-value pairs to be passed on as process environment variables. eg: FOO: 123" + default: [] logstash.queue.type: description: Internal queuing model, "memory" for legacy in-memory based queuing and "persisted" for disk-based acked queueing. diff --git a/jobs/ingestor_syslog/templates/bin/ingestor_syslog_ctl b/jobs/ingestor_syslog/templates/bin/ingestor_syslog_ctl index f05ee4fb..97c6eeb4 100644 --- a/jobs/ingestor_syslog/templates/bin/ingestor_syslog_ctl +++ b/jobs/ingestor_syslog/templates/bin/ingestor_syslog_ctl @@ -35,6 +35,9 @@ export HEAP_SIZE=$((( $( cat /proc/meminfo | grep MemTotal | awk '{ print $2 }' <% if_p('logstash.heap_size') do |heap_size| %> HEAP_SIZE=<%= heap_size %> <% end %> +<% p("logstash.env").each do |env| %> +export <%= env.keys[0] %>="<%= env.values[0] %>" +<% end %> case $1 in From 98604c308d63e183f2ae57867e058c1a8ad20478 Mon Sep 17 00:00:00 2001 From: Andrei Krasnitski Date: Tue, 25 Jul 2017 21:07:52 +0300 Subject: [PATCH 04/19] Remove queue job/package Remove message broker since logstash persistent queues enabled by default --- config/blobs.yml | 4 - jobs/queue/monit | 15 - jobs/queue/spec | 30 - jobs/queue/templates/bin/monit_debugger | 13 - jobs/queue/templates/bin/redis_ctl | 32 - jobs/queue/templates/config/redis.conf.erb | 748 ------------------ jobs/queue/templates/data/properties.sh.erb | 10 - jobs/queue/templates/helpers/ctl_setup.sh | 81 -- jobs/queue/templates/helpers/ctl_utils.sh | 182 ----- .../metric-collector/redis/collector | 65 -- packages/redis/packaging | 15 - packages/redis/spec | 5 - 12 files changed, 1200 deletions(-) delete mode 100644 jobs/queue/monit delete mode 100644 jobs/queue/spec delete mode 100644 jobs/queue/templates/bin/monit_debugger delete mode 100755 jobs/queue/templates/bin/redis_ctl delete mode 100644 jobs/queue/templates/config/redis.conf.erb delete mode 100644 jobs/queue/templates/data/properties.sh.erb delete mode 100644 jobs/queue/templates/helpers/ctl_setup.sh delete mode 100644 jobs/queue/templates/helpers/ctl_utils.sh delete mode 100644 jobs/queue/templates/logsearch/metric-collector/redis/collector delete mode 100644 packages/redis/packaging delete mode 100644 packages/redis/spec diff --git a/config/blobs.yml b/config/blobs.yml index 6cf2e6fa..96a5b365 100644 --- a/config/blobs.yml +++ b/config/blobs.yml @@ -94,10 +94,6 @@ python/Python-3.6.1.tgz: size: 22540566 object_id: db2b3522-9d58-4998-81ec-237d900ad740 sha: 6e91434cf22414af8240dfa1bf8ab2d043b04998 -redis/redis-3.2.9.tar.gz: - size: 1547695 - object_id: 11340b96-739f-4532-8a38-8e00661ee18a - sha: 8fad759f28bcb14b94254124d824f1f3ed7b6aa6 ruby2.3/bundler-1.11.2.gem: size: 263168 object_id: ce2c212f-c2ff-440e-9f4b-c2c214a010f9 diff --git a/jobs/queue/monit b/jobs/queue/monit deleted file mode 100644 index 30451dd4..00000000 --- a/jobs/queue/monit +++ /dev/null @@ -1,15 +0,0 @@ -check process queue_redis - with pidfile /var/vcap/sys/run/queue/queue.pid - start program "/var/vcap/jobs/queue/bin/monit_debugger queue_ctl '/var/vcap/jobs/queue/bin/redis_ctl start'" - stop program "/var/vcap/jobs/queue/bin/monit_debugger queue_ctl '/var/vcap/jobs/queue/bin/redis_ctl stop'" - group vcap - -check device queue-ephemeral_disk with path /var/vcap/data - if SPACE usage > 80% then alert - -check device queue-persistent_disk with path /var/vcap/store - if SPACE usage > 80% then alert - -check file queue-backlog with path /var/vcap/store/queue/redis-appendonly.aof - if size > 2 GB then alert - diff --git a/jobs/queue/spec b/jobs/queue/spec deleted file mode 100644 index be1809a2..00000000 --- a/jobs/queue/spec +++ /dev/null @@ -1,30 +0,0 @@ ---- -name: queue -packages: -- redis -templates: - bin/redis_ctl: bin/redis_ctl - bin/monit_debugger: bin/monit_debugger - data/properties.sh.erb: data/properties.sh - helpers/ctl_setup.sh: helpers/ctl_setup.sh - helpers/ctl_utils.sh: helpers/ctl_utils.sh - config/redis.conf.erb: config/redis.conf - logsearch/metric-collector/redis/collector: logsearch/metric-collector/redis/collector -properties: - redis.port: - description: Redis port of queue - default: 6379 - redis.key: - description: Name of queue to pull messages from - default: logstash - redis.maxmemory: - description: Maximum amount of memory to be used by Redis in % of system RAM. - example: 50 - default: 90 - redis.maxmemory-policy: - description: How Redis will select what to remove when maxmemory is reached. Possible values are volatile-lru, allkeys-lru, volatile-random, allkeys-random, volatile-ttl, and noeviction. - default: volatile-lru - redis.appendonly: - description: Enable Redis Persistence through AOF file - default: "yes" - diff --git a/jobs/queue/templates/bin/monit_debugger b/jobs/queue/templates/bin/monit_debugger deleted file mode 100644 index 55353d2a..00000000 --- a/jobs/queue/templates/bin/monit_debugger +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# USAGE monit_debugger