# HG changeset patch # User Carl Byington # Date 1363985138 25200 # Node ID 4899fb1b3eb3d3a9d9a382908a501864d44bf99f # Parent fa645feb1f0ef02c0e2d0c6d379bb87c8eedbae1 add sysconfig snippet to avoid modifying non-config files diff -r fa645feb1f0e -r 4899fb1b3eb3 logstash.cron --- a/logstash.cron Fri Mar 22 12:58:33 2013 -0700 +++ b/logstash.cron Fri Mar 22 13:45:38 2013 -0700 @@ -1,4 +1,6 @@ #!/bin/bash -/usr/local/bin/logstash_index_cleaner.py -d 7 +. /etc/sysconfig/logstash +/usr/local/bin/logstash_index_cleaner.py -d $DAYS + diff -r fa645feb1f0e -r 4899fb1b3eb3 logstash.rc --- a/logstash.rc Fri Mar 22 12:58:33 2013 -0700 +++ b/logstash.rc Fri Mar 22 13:45:38 2013 -0700 @@ -23,20 +23,21 @@ # Amount of memory for Java #JAVAMEM=256M +. /etc/sysconfig/logstash + export HOME=/var/lib/logstash DESC="Logstash Daemon" JAVA=$(which java) CONFIGFILE=/etc/logstash/logstash.conf LOGFILE=/var/log/logstash/logstash.log JARNAME=/usr/local/bin/logstash.jar -ARGS="-jar ${JARNAME} agent --config ${CONFIGFILE} --log ${LOGFILE} -- web --backend elasticsearch://127.0.0.1/?local" -SCRIPTNAME=/etc/rc.d/init.d/logstash +ARGS="-jar $JARNAME agent --config $CONFIGFILE --log $LOGFILE $AGENTARGS -- web $WEBARGS" PIDFILE=/var/run/logstash.pid base=logstash # Exit if java is not installed if [ ! -x "$JAVA" ]; then - echo "Couldn't find $JAVA" + echo "Couldn't find java" exit 99 fi @@ -93,7 +94,7 @@ status -p $PIDFILE ;; *) - echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2 + echo "Usage: service $base {start|stop|status|restart}" >&2 exit 3 ;; esac diff -r fa645feb1f0e -r 4899fb1b3eb3 logstash.spec --- a/logstash.spec Fri Mar 22 12:58:33 2013 -0700 +++ b/logstash.spec Fri Mar 22 13:45:38 2013 -0700 @@ -16,6 +16,7 @@ Source10: %{name}.rc Source11: %{name}.cron Source12: %{name}.conf +Source13: %{name}.sysconfig Source20: apache.pattern Source21: sendmail.pattern Source22: dnsbl.pattern @@ -51,6 +52,7 @@ install -D -m 755 %SOURCE10 $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} install -D -m 755 %SOURCE11 $RPM_BUILD_ROOT/etc/cron.daily/%{name} install -D -m 640 %SOURCE12 $RPM_BUILD_ROOT/etc/%{name}/%{name}.conf +install -D -m 640 %SOURCE13 $RPM_BUILD_ROOT/etc/sysconfig/%{name} install -D -m 640 %SOURCE20 $RPM_BUILD_ROOT/var/lib/%{name}/data/patterns/apache install -D -m 640 %SOURCE21 $RPM_BUILD_ROOT/var/lib/%{name}/data/patterns/sendmail install -D -m 640 %SOURCE22 $RPM_BUILD_ROOT/var/lib/%{name}/data/patterns/dnsbl @@ -89,6 +91,7 @@ %attr(0750,%{name},root) %{_bindir}/* %dir %attr(0750,%{name},root) /etc/%{name} %config(noreplace) %attr(0640,%{name},root) /etc/%{name}/%{name}.conf +%config(noreplace) %attr(0640,%{name},root) /etc/sysconfig/%{name} /etc/rc.d/init.d/%{name} /etc/cron.daily/%{name} %dir %attr(0750,%{name},root) /var/log/%{name} diff -r fa645feb1f0e -r 4899fb1b3eb3 logstash.sysconfig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/logstash.sysconfig Fri Mar 22 13:45:38 2013 -0700 @@ -0,0 +1,9 @@ +# used by /etc/cron.daily/logstash +DAYS=7 + + +# used by /etc/rc.d/init.d/logstash +# extra args for agent +AGENTARGS= +# args for web +WEBARGS="--backend elasticsearch://127.0.0.1/?local" \ No newline at end of file