Created
June 12, 2014 07:12
-
-
Save hakobera/ca0ee8f8198cbb17974e to your computer and use it in GitHub Desktop.
.ebextensions for Papertrail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| packages: | |
| yum: | |
| gcc-c++: [] | |
| make: [] | |
| ruby-devel: [] | |
| openssl-devel: [] | |
| rubygems: | |
| remote_syslog: [] | |
| files: | |
| "/etc/remote_applog.yml": | |
| mode: "00644" | |
| owner: root | |
| group: root | |
| encoding: plain | |
| content: | | |
| files: | |
| - /var/log/eb-version-deployment.log | |
| - /var/log/eb-tools.log | |
| - /var/log/cfn-hup.log | |
| - /var/log/nginx/access.log | |
| - /var/log/nginx/error.log | |
| - /var/log/directory-hooks-executor.log | |
| - /var/log/docker-events.log | |
| - /var/log/eb-cfn-init.log | |
| - /var/log/cfn-init.log | |
| - /var/log/eb-cfn-init-call.log | |
| - /var/log/eb-publish-logs.log | |
| - /var/log/docker | |
| hostname: YOU-HOST-NAME | |
| destination: | |
| host: PAPERTRAIL-HOST | |
| port: PAPERTRAIL-PORT | |
| "/etc/init.d/remote_applog": | |
| mode: "00555" | |
| owner: root | |
| group: root | |
| encoding: plain | |
| content: | | |
| #!/bin/bash | |
| # | |
| # remote_syslog This shell script takes care of starting and stopping | |
| # remote_syslog daemon | |
| # | |
| # chkconfig: - 58 74 | |
| # description: papertrail/remote_syslog \ | |
| # https://github.com/papertrail/remote_syslog/blob/master/examples/remote_syslog.init.d | |
| ### BEGIN INIT INFO | |
| # Provides: remote_applog | |
| # Required-Start: $network $local_fs $remote_fs | |
| # Required-Stop: $network $local_fs $remote_fs | |
| # Should-Start: $syslog $named ntpdate | |
| # Should-Stop: $syslog $named | |
| # Short-Description: start and stop remote_errolog | |
| # Description: papertrail/remote_syslog | |
| # https://github.com/papertrail/remote_syslog/blob/master/examples/remote_syslog.init.d | |
| ### END INIT INFO | |
| # Source function library. | |
| . /etc/init.d/functions | |
| # Source networking configuration. | |
| . /etc/sysconfig/network | |
| if [ -f /usr/bin/remote_syslog ]; then | |
| prog="/usr/bin/remote_syslog" | |
| elif [ -f /usr/local/bin/remote_syslog ]; then | |
| prog="/usr/local/bin/remote_syslog" | |
| else | |
| prog="/opt/elasticbeanstalk/bin/remote_syslog" | |
| fi | |
| config="/etc/remote_applog.yml" | |
| pid_dir="/var/run" | |
| EXTRAOPTIONS="" | |
| pid_file="$pid_dir/remote_applog.pid" | |
| PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin | |
| RETVAL=0 | |
| is_running(){ | |
| [ -e $pid_file ] | |
| } | |
| start(){ | |
| echo -n $"Starting $prog: " | |
| unset HOME MAIL USER USERNAME | |
| $prog -c $config --tcp --pid-file $pid_file "$EXTRAOPTIONS" | |
| RETVAL=$? | |
| echo | |
| return $RETVAL | |
| } | |
| stop(){ | |
| echo -n $"Stopping $prog: " | |
| if (is_running); then | |
| kill `cat $pid_file` | |
| RETVAL=$? | |
| echo | |
| return $RETVAL | |
| else | |
| echo "$pid_file not found" | |
| fi | |
| } | |
| status(){ | |
| echo -n $"Checking for $pid_file: " | |
| if (is_running); then | |
| echo "found" | |
| else | |
| echo "not found" | |
| fi | |
| } | |
| reload(){ | |
| restart | |
| } | |
| restart(){ | |
| stop | |
| start | |
| } | |
| condrestart(){ | |
| is_running && restart | |
| return 0 | |
| } | |
| # See how we were called. | |
| case "$1" in | |
| start) | |
| start | |
| ;; | |
| stop) | |
| stop | |
| ;; | |
| status) | |
| status | |
| ;; | |
| restart) | |
| restart | |
| ;; | |
| reload) | |
| reload | |
| ;; | |
| condrestart) | |
| condrestart | |
| ;; | |
| *) | |
| echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" | |
| RETVAL=1 | |
| esac | |
| exit $RETVAL | |
| "/etc/rsyslog.d/papertrail.conf" | |
| mode: "00644" | |
| owner: root | |
| group: root | |
| encoding: plain | |
| content: | | |
| *.* @HOST:PORT | |
| commands: | |
| 01_enable_service: | |
| command: "/sbin/chkconfig remote_applog on" | |
| 02_start_service: | |
| command: "/sbin/service rsyslog restart && /sbin/service remote_applog restart" | |
| ignoreErrors: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment