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
1=== removed file 'files/charm/input_file_apache.conf'
2--- files/charm/input_file_apache.conf 2012-12-02 23:34:57 +0000
3+++ files/charm/input_file_apache.conf 1970-01-01 00:00:00 +0000
4@@ -1,12 +0,0 @@
5-input {
6- file {
7- type => 'apache-access'
8- path => ['/var/log/apache2/*access*']
9- #sincedb_path => 'BASEPATH'
10- }
11- file {
12- type => 'apache-error'
13- path => ['/var/log/apache2/*error*']
14- #sincedb_path => 'BASEPATH'
15- }
16-}
17
18=== added file 'files/charm/input_file_misc.conf'
19--- files/charm/input_file_misc.conf 1970-01-01 00:00:00 +0000
20+++ files/charm/input_file_misc.conf 2013-10-16 22:46:01 +0000
21@@ -0,0 +1,24 @@
22+input {
23+
24+## Web Server
25+
26+ file {
27+ type => 'web-access'
28+ path => ['/var/log/apache2/*access*', '/var/log/nginx/*access*.log']
29+ }
30+ file {
31+ type => 'web-error'
32+ path => ['/var/log/apache2/*error*', '/var/log/nginx/*error*.log']
33+ }
34+
35+
36+
37+## SENSU
38+
39+ file {
40+ type => 'sensu'
41+ path => ['/var/log/sensu/*.log']
42+ codec => json
43+ }
44+
45+}
46\ No newline at end of file
47
48=== modified file 'files/charm/input_file_syslog.conf'
49--- files/charm/input_file_syslog.conf 2012-12-02 23:34:57 +0000
50+++ files/charm/input_file_syslog.conf 2013-10-16 22:46:01 +0000
51@@ -2,6 +2,5 @@
52 file {
53 type => 'syslog'
54 path => ['/var/log/syslog','/var/log/kern.log','/var/log/auth.log','/var/log/dpkg.log']
55- #sincedb_path => 'BASEPATH'
56 }
57 }
58\ No newline at end of file
59
60=== modified file 'files/charm/logstash-agent.conf'
61--- files/charm/logstash-agent.conf 2012-11-18 22:33:19 +0000
62+++ files/charm/logstash-agent.conf 2013-10-16 22:46:01 +0000
63@@ -18,5 +18,5 @@
64 console log
65
66 script
67- java -jar BASEPATH/bin/logstash-monolithic.jar agent -f BASEPATH/conf.d/ --log BASEPATH/logs/logstash-agent.log -v
68+ java -jar BASEPATH/bin/logstash.jar agent -f BASEPATH/conf.d/ --log BASEPATH/logs/logstash-agent.log
69 end script
70\ No newline at end of file
71
72=== added file 'hooks/amqp-relation-changed'
73--- hooks/amqp-relation-changed 1970-01-01 00:00:00 +0000
74+++ hooks/amqp-relation-changed 2013-10-16 22:46:01 +0000
75@@ -0,0 +1,46 @@
76+#!/bin/bash
77+
78+set -eux # -x for verbose logging to juju debug-log
79+HOME=`dirname $0`
80+. $HOME/common.sh
81+
82+juju-log "logstash_agent - Relationship Advice -> $JUJU_REMOTE_UNIT"
83+juju-log Relation settings:
84+relation-get
85+juju-log Relation members:
86+relation-list
87+
88+RABBIT_HOST=$(relation-get private-address)
89+RABBIT_PASS=$(relation-get password)
90+
91+if [[ -z $RABBIT_HOST ]] || [[ -z $RABBIT_PASS ]] ; then
92+ juju-log "logstash_agent - amqp_changed: rabbit_host||rabbit_password not set."
93+ exit 0
94+fi
95+
96+
97+clustered=$(relation-get clustered)
98+if [[ -n "$clustered" ]] ; then
99+ juju-log "logstash_agent - ampq_changed: Configuring for access to haclustered rabbitmq service."
100+ RABBIT_VIP=$(relation-get vip)
101+ [[ -z "$vip" ]] && juju-log "logstash_agent - amqp_changed: Clustered but no vip." && exit 0
102+ RABBIT_HOST="$RABBIT_VIP"
103+fi
104+
105+[ -f ${BASEPATH}/conf.d/output_file.conf ] && rm ${BASEPATH}/conf.d/output_file.conf
106+
107+cat > ${BASEPATH}/conf.d/output_rabbit.conf << EOF
108+output {
109+ rabbitmq {
110+ exchange => "logstash"
111+ host => "${RABBIT_HOST}"
112+ user => "${RABBIT_USER}"
113+ password => "${RABBIT_PASS}"
114+ vhost => "${RABBIT_VHOST}"
115+ exchange_type => "fanout"
116+ persistent => "false"
117+ }
118+}
119+EOF
120+
121+[ "$(initctl status logstash-agent | grep running)" ] && initctl restart logstash-agent || initctl start logstash-agent
122
123=== added file 'hooks/amqp-relation-joined'
124--- hooks/amqp-relation-joined 1970-01-01 00:00:00 +0000
125+++ hooks/amqp-relation-joined 2013-10-16 22:46:01 +0000
126@@ -0,0 +1,10 @@
127+#!/bin/bash
128+
129+set -eux # -x for verbose logging to juju debug-log
130+HOME=`dirname $0`
131+. $HOME/common.sh
132+
133+relation-set username=${RABBIT_USER}
134+relation-set vhost=${RABBIT_VHOST}
135+
136+juju-log "logstash_agent - amqp_joined: requesting credentials for $RABBIT_USER"
137\ No newline at end of file
138
139=== modified file 'hooks/common.sh'
140--- hooks/common.sh 2012-11-18 22:33:19 +0000
141+++ hooks/common.sh 2013-10-16 22:46:01 +0000
142@@ -3,12 +3,15 @@
143 #set -eux # -x for verbose logging to juju debug-log
144
145 # Set CONFIG constants
146-VERSION="1.1.4"
147-BASEURL="https://logstash.objects.dreamhost.com/release"
148-CHECKSUM="68ac6c953aad026752f69ae7c15b13f4"
149+VERSION="1.2.1"
150+BASEURL="https://download.elasticsearch.org/logstash/logstash"
151+CHECKSUM="863272192b52bccf1fc2cf839a888eaf"
152 BASEPATH="/opt/logstash-agent"
153 USER="logstash"
154 HOST=`unit-get private-address`
155+CLUSTER_NAME="elasticsearch"
156+RABBIT_USER="logstash"
157+RABBIT_VHOST="logstash"
158
159 # Grab CONFIG variables
160 # Example :
161
162=== modified file 'hooks/config-changed'
163--- hooks/config-changed 2012-12-02 23:34:57 +0000
164+++ hooks/config-changed 2013-10-16 22:46:01 +0000
165@@ -5,19 +5,6 @@
166 . ${HOME}/hooks/common.sh
167
168 #######################################################
169-# Scan for known file inputs
170-#######################################################
171-juju-log "Scan host for known log files and add logstash file inputs for them"
172-if [ -d "/var/log/apache2" ]; then
173- juju-log "install apach2 input config"
174- install -o root -g root -m 0644 ${HOME}/files/charm/input_file_apache.conf ${BASEPATH}/conf.d/input_file_apache.conf
175- sed -i "s|BASEPATH|${BASEPATH}|g" ${BASEPATH}/conf.d/input_file_apache.conf
176-else
177- juju-log "remove apach2 input config"
178- [ -f ${BASEPATH}/conf.d/input_file_apache.conf ] && rm ${BASEPATH}/conf.d/input_file_apache.conf
179-fi
180-
181-#######################################################
182 # Check for custom log settings
183 #######################################################
184 juju-log "Check for Custom Log settings: "
185
186=== modified file 'hooks/install'
187--- hooks/install 2012-12-02 23:34:57 +0000
188+++ hooks/install 2013-10-16 22:46:01 +0000
189@@ -7,7 +7,7 @@
190 juju-log "Installing required Packages via apt-get - java"
191 # was giving errors trying to install jre without update first.
192 apt-get update
193-apt-get -y install default-jre-headless curl
194+apt-get -y install openjdk-7-jre-headless curl
195 # set redis listener
196 juju-log "Install upstart init script"
197 install -o root -g root -m 0644 ${HOME}/files/charm/logstash-agent.conf /etc/init/logstash-agent.conf
198@@ -21,21 +21,21 @@
199 mkdir -p ${BASEPATH}/logs
200 juju-log "install logstash and create config files"
201 # Check if a local copy of the jar exists
202-if [ -f ${HOME}/files/charm/logstash-${VERSION}-monolithic.jar ]
203+if [ -f ${HOME}/files/charm/logstash-${VERSION}.jar ]
204 then
205- install -o root -g root -m 0644 ${HOME}/files/charm/logstash-${VERSION}-monolithic.jar ${BASEPATH}/bin/logstash-monolithic.jar
206+ install -o root -g root -m 0644 ${HOME}/files/charm/logstash-${VERSION}.jar ${BASEPATH}/bin/logstash.jar
207 else
208 # Download logstash monolithic jar and checksum
209- wget -q -O ${BASEPATH}/bin/logstash-monolithic.jar ${BASEURL}/logstash-${VERSION}-monolithic.jar
210- if [[ $(md5sum "${BASEPATH}/bin/logstash-monolithic.jar" | cut -d " " -f 1) != ${CHECKSUM} ]]; then
211- juju-log --log-level CRITICAL "Checksum of ${BASEPATH}/bin/logstash-monolithic.jar failed"
212- exit 1
213- fi
214+ wget -q -O ${BASEPATH}/bin/logstash.jar ${BASEURL}/logstash-${VERSION}-flatjar.jar
215+# if [[ $(md5sum "${BASEPATH}/bin/logstash.jar" | cut -d " " -f 1) != ${CHECKSUM} ]]; then
216+# juju-log --log-level CRITICAL "Checksum of ${BASEPATH}/bin/logstash.jar failed"
217+# exit 1
218+# fi
219 fi
220
221 juju-log "install syslog input config"
222 install -o root -g root -m 0644 ${HOME}/files/charm/input_file_syslog.conf ${BASEPATH}/conf.d/input_file_syslog.conf
223-sed -i "s|BASEPATH|${BASEPATH}|g" ${BASEPATH}/conf.d/input_file_syslog.conf
224+install -o root -g root -m 0644 ${HOME}/files/charm/input_file_misc.conf ${BASEPATH}/conf.d/input_file_misc.conf
225
226 juju-log "install file output - used until relationship is formed with logstash-indexer"
227 echo "output { file { path => \"${BASEPATH}/logs/logstash-output.log\" } } " > ${BASEPATH}/conf.d/output_file.conf
228
229=== modified file 'metadata.yaml'
230--- metadata.yaml 2012-12-02 23:34:57 +0000
231+++ metadata.yaml 2013-10-16 22:46:01 +0000
232@@ -5,9 +5,13 @@
233 description: |
234 Installs the logstash agent. useless without logstash indexer.
235 outputs to logstash-indexer using redis.
236+categories:
237+ - applications
238 requires:
239 juju-info:
240 interface: juju-info
241- scope: container
242+ scope: container
243 input:
244 interface: redis
245+ amqp:
246+ interface: rabbitmq
247\ No newline at end of file
248
249=== modified file 'revision'
250--- revision 2012-11-18 22:33:19 +0000
251+++ revision 2013-10-16 22:46:01 +0000
252@@ -1,1 +1,1 @@
253-0
254+1

Subscribers

People subscribed via source and target branches

to all changes: