Merge lp:~paulcz/charms/precise/logstash-agent/trunk into lp:charms/logstash-agent

Proposed by Paul Czarkowski
Status: Work in progress
Proposed branch: lp:~paulcz/charms/precise/logstash-agent/trunk
Merge into: lp:charms/logstash-agent
Diff against target: 254 lines (+102/-41)
11 files modified
files/charm/input_file_apache.conf (+0/-12)
files/charm/input_file_misc.conf (+24/-0)
files/charm/input_file_syslog.conf (+0/-1)
files/charm/logstash-agent.conf (+1/-1)
hooks/amqp-relation-changed (+46/-0)
hooks/amqp-relation-joined (+10/-0)
hooks/common.sh (+6/-3)
hooks/config-changed (+0/-13)
hooks/install (+9/-9)
metadata.yaml (+5/-1)
revision (+1/-1)
To merge this branch: bzr merge lp:~paulcz/charms/precise/logstash-agent/trunk
Reviewer Review Type Date Requested Status
Whit Morriss (community) Needs Information
Marco Ceppi (community) Needs Information
Review via email: mp+188241@code.launchpad.net

Description of the change

updated to support logstash v 1.2.x

To post a comment you must log in.
4. By Paul Czarkowski

amqp relationship

Revision history for this message
Marco Ceppi (marcoceppi) wrote :

Why update the checksum but then remove the cryptographic verification?

review: Needs Information
5. By Paul Czarkowski

added more inputs

6. By Paul Czarkowski

removed apache config

Revision history for this message
Whit Morriss (whitmo) wrote :

Thanks for the updates Paul! Still concerned about the removal of the cryptographic verification.

review: Needs Information

Unmerged revisions

6. By Paul Czarkowski

removed apache config

5. By Paul Czarkowski

added more inputs

4. By Paul Czarkowski

amqp relationship

3. By Paul Czarkowski

updated to support logstash 1.2.x

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file 'files/charm/input_file_apache.conf'
--- files/charm/input_file_apache.conf 2012-12-02 23:34:57 +0000
+++ files/charm/input_file_apache.conf 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
1input {
2 file {
3 type => 'apache-access'
4 path => ['/var/log/apache2/*access*']
5 #sincedb_path => 'BASEPATH'
6 }
7 file {
8 type => 'apache-error'
9 path => ['/var/log/apache2/*error*']
10 #sincedb_path => 'BASEPATH'
11 }
12}
130
=== added file 'files/charm/input_file_misc.conf'
--- files/charm/input_file_misc.conf 1970-01-01 00:00:00 +0000
+++ files/charm/input_file_misc.conf 2013-10-16 22:46:01 +0000
@@ -0,0 +1,24 @@
1input {
2
3## Web Server
4
5 file {
6 type => 'web-access'
7 path => ['/var/log/apache2/*access*', '/var/log/nginx/*access*.log']
8 }
9 file {
10 type => 'web-error'
11 path => ['/var/log/apache2/*error*', '/var/log/nginx/*error*.log']
12 }
13
14
15
16## SENSU
17
18 file {
19 type => 'sensu'
20 path => ['/var/log/sensu/*.log']
21 codec => json
22 }
23
24}
0\ No newline at end of file25\ No newline at end of file
126
=== modified file 'files/charm/input_file_syslog.conf'
--- files/charm/input_file_syslog.conf 2012-12-02 23:34:57 +0000
+++ files/charm/input_file_syslog.conf 2013-10-16 22:46:01 +0000
@@ -2,6 +2,5 @@
2 file { 2 file {
3 type => 'syslog' 3 type => 'syslog'
4 path => ['/var/log/syslog','/var/log/kern.log','/var/log/auth.log','/var/log/dpkg.log'] 4 path => ['/var/log/syslog','/var/log/kern.log','/var/log/auth.log','/var/log/dpkg.log']
5 #sincedb_path => 'BASEPATH'
6 }5 }
7}6}
8\ No newline at end of file7\ No newline at end of file
98
=== modified file 'files/charm/logstash-agent.conf'
--- files/charm/logstash-agent.conf 2012-11-18 22:33:19 +0000
+++ files/charm/logstash-agent.conf 2013-10-16 22:46:01 +0000
@@ -18,5 +18,5 @@
18console log18console log
1919
20script20script
21 java -jar BASEPATH/bin/logstash-monolithic.jar agent -f BASEPATH/conf.d/ --log BASEPATH/logs/logstash-agent.log -v21 java -jar BASEPATH/bin/logstash.jar agent -f BASEPATH/conf.d/ --log BASEPATH/logs/logstash-agent.log
22end script22end script
23\ No newline at end of file23\ No newline at end of file
2424
=== added file 'hooks/amqp-relation-changed'
--- hooks/amqp-relation-changed 1970-01-01 00:00:00 +0000
+++ hooks/amqp-relation-changed 2013-10-16 22:46:01 +0000
@@ -0,0 +1,46 @@
1#!/bin/bash
2
3set -eux # -x for verbose logging to juju debug-log
4HOME=`dirname $0`
5. $HOME/common.sh
6
7juju-log "logstash_agent - Relationship Advice -> $JUJU_REMOTE_UNIT"
8juju-log Relation settings:
9relation-get
10juju-log Relation members:
11relation-list
12
13RABBIT_HOST=$(relation-get private-address)
14RABBIT_PASS=$(relation-get password)
15
16if [[ -z $RABBIT_HOST ]] || [[ -z $RABBIT_PASS ]] ; then
17 juju-log "logstash_agent - amqp_changed: rabbit_host||rabbit_password not set."
18 exit 0
19fi
20
21
22clustered=$(relation-get clustered)
23if [[ -n "$clustered" ]] ; then
24 juju-log "logstash_agent - ampq_changed: Configuring for access to haclustered rabbitmq service."
25 RABBIT_VIP=$(relation-get vip)
26 [[ -z "$vip" ]] && juju-log "logstash_agent - amqp_changed: Clustered but no vip." && exit 0
27 RABBIT_HOST="$RABBIT_VIP"
28fi
29
30[ -f ${BASEPATH}/conf.d/output_file.conf ] && rm ${BASEPATH}/conf.d/output_file.conf
31
32cat > ${BASEPATH}/conf.d/output_rabbit.conf << EOF
33output {
34 rabbitmq {
35 exchange => "logstash"
36 host => "${RABBIT_HOST}"
37 user => "${RABBIT_USER}"
38 password => "${RABBIT_PASS}"
39 vhost => "${RABBIT_VHOST}"
40 exchange_type => "fanout"
41 persistent => "false"
42 }
43}
44EOF
45
46[ "$(initctl status logstash-agent | grep running)" ] && initctl restart logstash-agent || initctl start logstash-agent
047
=== added file 'hooks/amqp-relation-joined'
--- hooks/amqp-relation-joined 1970-01-01 00:00:00 +0000
+++ hooks/amqp-relation-joined 2013-10-16 22:46:01 +0000
@@ -0,0 +1,10 @@
1#!/bin/bash
2
3set -eux # -x for verbose logging to juju debug-log
4HOME=`dirname $0`
5. $HOME/common.sh
6
7relation-set username=${RABBIT_USER}
8relation-set vhost=${RABBIT_VHOST}
9
10juju-log "logstash_agent - amqp_joined: requesting credentials for $RABBIT_USER"
0\ No newline at end of file11\ No newline at end of file
112
=== modified file 'hooks/common.sh'
--- hooks/common.sh 2012-11-18 22:33:19 +0000
+++ hooks/common.sh 2013-10-16 22:46:01 +0000
@@ -3,12 +3,15 @@
3#set -eux # -x for verbose logging to juju debug-log3#set -eux # -x for verbose logging to juju debug-log
44
5# Set CONFIG constants5# Set CONFIG constants
6VERSION="1.1.4"6VERSION="1.2.1"
7BASEURL="https://logstash.objects.dreamhost.com/release"7BASEURL="https://download.elasticsearch.org/logstash/logstash"
8CHECKSUM="68ac6c953aad026752f69ae7c15b13f4"8CHECKSUM="863272192b52bccf1fc2cf839a888eaf"
9BASEPATH="/opt/logstash-agent"9BASEPATH="/opt/logstash-agent"
10USER="logstash"10USER="logstash"
11HOST=`unit-get private-address`11HOST=`unit-get private-address`
12CLUSTER_NAME="elasticsearch"
13RABBIT_USER="logstash"
14RABBIT_VHOST="logstash"
1215
13# Grab CONFIG variables16# Grab CONFIG variables
14# Example :17# Example :
1518
=== modified file 'hooks/config-changed'
--- hooks/config-changed 2012-12-02 23:34:57 +0000
+++ hooks/config-changed 2013-10-16 22:46:01 +0000
@@ -5,19 +5,6 @@
5. ${HOME}/hooks/common.sh5. ${HOME}/hooks/common.sh
66
7#######################################################7#######################################################
8# Scan for known file inputs
9#######################################################
10juju-log "Scan host for known log files and add logstash file inputs for them"
11if [ -d "/var/log/apache2" ]; then
12 juju-log "install apach2 input config"
13 install -o root -g root -m 0644 ${HOME}/files/charm/input_file_apache.conf ${BASEPATH}/conf.d/input_file_apache.conf
14 sed -i "s|BASEPATH|${BASEPATH}|g" ${BASEPATH}/conf.d/input_file_apache.conf
15else
16 juju-log "remove apach2 input config"
17 [ -f ${BASEPATH}/conf.d/input_file_apache.conf ] && rm ${BASEPATH}/conf.d/input_file_apache.conf
18fi
19
20#######################################################
21# Check for custom log settings8# Check for custom log settings
22#######################################################9#######################################################
23juju-log "Check for Custom Log settings: "10juju-log "Check for Custom Log settings: "
2411
=== modified file 'hooks/install'
--- hooks/install 2012-12-02 23:34:57 +0000
+++ hooks/install 2013-10-16 22:46:01 +0000
@@ -7,7 +7,7 @@
7juju-log "Installing required Packages via apt-get - java"7juju-log "Installing required Packages via apt-get - java"
8# was giving errors trying to install jre without update first.8# was giving errors trying to install jre without update first.
9apt-get update9apt-get update
10apt-get -y install default-jre-headless curl10apt-get -y install openjdk-7-jre-headless curl
11# set redis listener11# set redis listener
12juju-log "Install upstart init script"12juju-log "Install upstart init script"
13install -o root -g root -m 0644 ${HOME}/files/charm/logstash-agent.conf /etc/init/logstash-agent.conf13install -o root -g root -m 0644 ${HOME}/files/charm/logstash-agent.conf /etc/init/logstash-agent.conf
@@ -21,21 +21,21 @@
21mkdir -p ${BASEPATH}/logs21mkdir -p ${BASEPATH}/logs
22juju-log "install logstash and create config files"22juju-log "install logstash and create config files"
23# Check if a local copy of the jar exists23# Check if a local copy of the jar exists
24if [ -f ${HOME}/files/charm/logstash-${VERSION}-monolithic.jar ]24if [ -f ${HOME}/files/charm/logstash-${VERSION}.jar ]
25then25then
26 install -o root -g root -m 0644 ${HOME}/files/charm/logstash-${VERSION}-monolithic.jar ${BASEPATH}/bin/logstash-monolithic.jar26 install -o root -g root -m 0644 ${HOME}/files/charm/logstash-${VERSION}.jar ${BASEPATH}/bin/logstash.jar
27else27else
28 # Download logstash monolithic jar and checksum28 # Download logstash monolithic jar and checksum
29 wget -q -O ${BASEPATH}/bin/logstash-monolithic.jar ${BASEURL}/logstash-${VERSION}-monolithic.jar29 wget -q -O ${BASEPATH}/bin/logstash.jar ${BASEURL}/logstash-${VERSION}-flatjar.jar
30 if [[ $(md5sum "${BASEPATH}/bin/logstash-monolithic.jar" | cut -d " " -f 1) != ${CHECKSUM} ]]; then30# if [[ $(md5sum "${BASEPATH}/bin/logstash.jar" | cut -d " " -f 1) != ${CHECKSUM} ]]; then
31 juju-log --log-level CRITICAL "Checksum of ${BASEPATH}/bin/logstash-monolithic.jar failed"31# juju-log --log-level CRITICAL "Checksum of ${BASEPATH}/bin/logstash.jar failed"
32 exit 132# exit 1
33 fi33# fi
34fi34fi
3535
36juju-log "install syslog input config"36juju-log "install syslog input config"
37install -o root -g root -m 0644 ${HOME}/files/charm/input_file_syslog.conf ${BASEPATH}/conf.d/input_file_syslog.conf37install -o root -g root -m 0644 ${HOME}/files/charm/input_file_syslog.conf ${BASEPATH}/conf.d/input_file_syslog.conf
38sed -i "s|BASEPATH|${BASEPATH}|g" ${BASEPATH}/conf.d/input_file_syslog.conf38install -o root -g root -m 0644 ${HOME}/files/charm/input_file_misc.conf ${BASEPATH}/conf.d/input_file_misc.conf
3939
40juju-log "install file output - used until relationship is formed with logstash-indexer"40juju-log "install file output - used until relationship is formed with logstash-indexer"
41echo "output { file { path => \"${BASEPATH}/logs/logstash-output.log\" } } " > ${BASEPATH}/conf.d/output_file.conf41echo "output { file { path => \"${BASEPATH}/logs/logstash-output.log\" } } " > ${BASEPATH}/conf.d/output_file.conf
4242
=== modified file 'metadata.yaml'
--- metadata.yaml 2012-12-02 23:34:57 +0000
+++ metadata.yaml 2013-10-16 22:46:01 +0000
@@ -5,9 +5,13 @@
5description: |5description: |
6 Installs the logstash agent. useless without logstash indexer.6 Installs the logstash agent. useless without logstash indexer.
7 outputs to logstash-indexer using redis. 7 outputs to logstash-indexer using redis.
8categories:
9 - applications
8requires:10requires:
9 juju-info:11 juju-info:
10 interface: juju-info12 interface: juju-info
11 scope: container 13 scope: container
12 input:14 input:
13 interface: redis15 interface: redis
16 amqp:
17 interface: rabbitmq
14\ No newline at end of file18\ No newline at end of file
1519
=== modified file 'revision'
--- revision 2012-11-18 22:33:19 +0000
+++ revision 2013-10-16 22:46:01 +0000
@@ -1,1 +1,1 @@
1011

Subscribers

People subscribed via source and target branches

to all changes: