diff --git a/Gemfile b/Gemfile index 90b4d56..bb66d39 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source :rubygems +source 'https://rubygems.org' gem "compass" gem "foreman" diff --git a/Gemfile.lock b/Gemfile.lock index 18f02e4..4aa58d0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,38 +1,60 @@ GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ specs: - albino (1.3.3) - posix-spawn (>= 0.3.6) - chunky_png (1.2.1) + chunky_png (1.2.9) classifier (1.3.3) fast-stemmer (>= 1.0.0) - compass (0.11.5) + colorator (0.1) + commander (4.1.5) + highline (~> 1.6.11) + compass (0.12.2) chunky_png (~> 1.2) fssm (>= 0.2.7) sass (~> 3.1) - directory_watcher (1.4.1) - fast-stemmer (1.0.0) - foreman (0.39.0) - term-ansicolor (~> 1.0.7) + dotenv (0.9.0) + fast-stemmer (1.0.2) + ffi (1.9.3) + foreman (0.63.0) + dotenv (>= 0.7) thor (>= 0.13.6) - fssm (0.2.7) - haml (3.1.3) - jekyll (0.11.2) - albino (~> 1.3) + fssm (0.2.10) + haml (4.0.4) + tilt + highline (1.6.20) + jekyll (1.3.1) classifier (~> 1.3) - directory_watcher (~> 1.1) - kramdown (~> 0.13) - liquid (~> 2.3) - maruku (~> 0.5) - kramdown (0.13.5) - liquid (2.3.0) - maruku (0.6.0) + colorator (~> 0.1) + commander (~> 4.1.3) + liquid (~> 2.5.2) + listen (~> 1.3) + maruku (~> 0.6.0) + pygments.rb (~> 0.5.0) + redcarpet (~> 2.3.0) + safe_yaml (~> 0.9.7) + kramdown (1.2.0) + liquid (2.5.4) + listen (1.3.1) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + rb-kqueue (>= 0.2) + maruku (0.6.1) syntax (>= 1.0.0) posix-spawn (0.3.6) - sass (3.1.7) + pygments.rb (0.5.4) + posix-spawn (~> 0.3.6) + yajl-ruby (~> 1.1.0) + rb-fsevent (0.9.3) + rb-inotify (0.9.2) + ffi (>= 0.5.0) + rb-kqueue (0.2.0) + ffi (>= 0.5.0) + redcarpet (2.3.0) + safe_yaml (0.9.7) + sass (3.2.12) syntax (1.0.0) - term-ansicolor (1.0.7) - thor (0.14.6) + thor (0.18.1) + tilt (1.4.1) + yajl-ruby (1.1.0) PLATFORMS ruby diff --git a/_config.yml b/_config.yml index 7482cd8..5d3390e 100644 --- a/_config.yml +++ b/_config.yml @@ -1,4 +1,4 @@ -auto: true +# auto: true title: logstash cookbook repo: logstash/cookbook branch: gh-pages diff --git a/index.md b/index.md index c9cde9b..e5da318 100644 --- a/index.md +++ b/index.md @@ -22,7 +22,7 @@ to run logstash from the upstart system daemon (comes with Ubuntu). ## [running with init](recipes/using-init/) -Run logstash as a service on your RHEL based system using this init script. +Run logstash as a service on your RHEL/Ubuntu based system using this init script. ## [parsing syslog](recipes/syslog-pri) diff --git a/recipes/using-init/index.md b/recipes/using-init/index.md index 781bc6c..caf96c5 100644 --- a/recipes/using-init/index.md +++ b/recipes/using-init/index.md @@ -5,7 +5,12 @@ tags: init,rhel --- * Goal: Run the logstash agent as a service using an init script. -* Target audience: Users who have RHEL based servers. +* Target audience: Users who have RHEL / Ubuntu based servers. + +# REHL {% include_code logstash.sh %} +# Ubuntu + +{% include_code logstash %} diff --git a/recipes/using-init/logstash b/recipes/using-init/logstash new file mode 100644 index 0000000..b68b974 --- /dev/null +++ b/recipes/using-init/logstash @@ -0,0 +1,69 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: logstash +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +. /lib/lsb/init-functions + +name="logstash" +logstash_bin="/usr/bin/java -- -jar /opt/logstash/logstash-1.2.2-flatjar.jar" +logstash_conf="/etc/logstash/logstash-indexer.conf" +logstash_log="/var/log/$name.log" +pid_file="/var/run/$name.pid" + +NICE_LEVEL="-n 19" + +start () { + command="/usr/bin/nice ${NICE_LEVEL} ${logstash_bin} agent -f $logstash_conf --log ${logstash_log} -- web" + + log_daemon_msg "Starting $name" + if start-stop-daemon --start --quiet --oknodo --pidfile "$pid_file" -b -m --exec $command; then + log_end_msg 0 + else + log_end_msg 1 + fi +} + +stop () { + echo "Stoping $name" + start-stop-daemon --stop --quiet --oknodo --pidfile "$pid_file" + echo "$name stopped" +} + +status () { + status_of_proc -p $pid_file "" "$name" +} + +case $1 in + start) + if status; then exit 0; fi + start + ;; + stop) + stop + ;; + reload) + stop + start + ;; + restart) + stop + start + ;; + status) + status && exit 0 || exit $? + ;; + *) + echo "Usage: $0 {start|stop|restart|reload|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/regen.sh b/regen.sh old mode 100644 new mode 100755