Skip to content

Instantly share code, notes, and snippets.

@mariussturm
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariussturm/bcd6a9f3138ae0912b92 to your computer and use it in GitHub Desktop.
Save mariussturm/bcd6a9f3138ae0912b92 to your computer and use it in GitHub Desktop.
Install Graylog web on SLES11
- Download http://packages.graylog2.org/releases/graylog2-web-interface/graylog2-web-interface-0.92.4.tgz
- install -d -o "graylog2" -g "graylog2" -m 0755 "/var/lib/graylog2-web"
- install -d -o "graylog2" -g "graylog2" -m 0755 "/var/log/graylog2-web"
- install -d -o "graylog2" -g "graylog2" -m 0755 "/var/run/graylog2-web"
- install -d -o "graylog2" -g "graylog2" -m 0755 "/etc/graylog2/web"
- tar xzvf graylog2-web-interface-0.92.4.tgz
- cp -r graylog2-web-interface-0.92.4 /usr/share/graylog2-web
- cp /usr/share/graylog2-web/conf/application.conf /etc/graylog2/web/
- cp /usr/share/graylog2-web/conf/play.plugins /etc/graylog2/web/
- cp /usr/share/graylog2-web/conf/graylog2-web-interface.conf /etc/graylog2/web/web.conf
- vi /etc/graylog2/web/web.conf
graylog2-server.uris="http://127.0.0.1:12900"
application.secret="TBTFUc9PqW9BjOTlwAsYKEtESxTqntfnx5guD48EnWttP3AfZVhYL2nteWof8npeIlfAcXOUUbYhXnU8lX68qcpPhc2bMQwb"
- vi /etc/graylog2/web/logback.xml
```
<configuration>
<conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" />
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/var/log/graylog2-web/application.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- Daily rollover -->
<fileNamePattern>/var/log/graylog2-web/application.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- Keep 30 days worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX} - [%level] - from %logger in %thread %n%message%n%xException%n</pattern>
</encoder>
</appender>
<logger name="play" level="INFO" />
<logger name="application" level="INFO" />
<root level="ERROR">
<appender-ref ref="FILE" />
</root>
</configuration>
``` #################################################################
- vi /etc/sysconfig/graylog2-web
```
# Path to the java executable.
JAVA=/usr/bin/java
# HTTP server settings.
GRAYLOG_WEB_HTTP_ADDRESS="0.0.0.0"
GRAYLOG_WEB_HTTP_PORT="9000"
# Might be used to adjust the Java heap size. (i.e. "-Xms1024m -Xmx2048m")
GRAYLOG_WEB_JAVA_OPTS=""
# Pass some extra args to graylog-web. (i.e. "-d" to enable debug mode)
GRAYLOG_WEB_ARGS=""
# Program that will be used to wrap the graylog-web command. Useful to
# support programs like authbind.
GRAYLOG_COMMAND_WRAPPER=""
``` #################################################################
- vi /etc/init.d/graylog2-web
```
#! /bin/sh
#
# graylog2-web Starts/stop the "graylog2-web" application
#
# chkconfig: - 99 1
# description: Runs the graylog2-web application
### BEGIN INIT INFO
# Provides: graylog2-web
# Required-Start: $network $named $remote_fs $syslog
# Required-Stop: $network $named $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Graylog2 Web
# Description: Graylog2 Web - Search your logs, create charts, send reports and be alerted when something happens.
### END INIT INFO
# Author: Lee Briggs <lee@leebriggs.co.uk>
# Contributor: Bernd Ahlers <bernd@torch.sh>
RETVAL=0
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Graylog2 Web"
NAME=graylog2-web
CMD=/usr/share/graylog2-web/bin/graylog2-web-interface
PID_FILE=/var/lib/graylog2-web/application.pid
SCRIPTNAME=/etc/init.d/$NAME
LOCKFILE=/var/lock/subsys/$NAME
RUN=yes
GRAYLOG_WEB_USER="graylog2"
EXEC="/usr/share/graylog2-web/bin/graylog2-web"
# Pull in sysconfig settings
[ -f /etc/sysconfig/graylog2-web ] && . /etc/sysconfig/graylog2-web
# Exit if the package is not installed
[ -e "$CMD" ] || exit 0
start() {
echo -n $"Starting ${NAME}: "
start_daemon -u $GRAYLOG_WEB_USER -p ${PID_FILE} $EXEC
RETVAL=$?
sleep 2
[ $RETVAL = 0 ] && touch ${LOCKFILE}
echo
return $RETVAL
}
stop() {
echo -n $"Stopping ${NAME}: "
killproc -p ${PID_FILE} java
RETVAL=$?
[ $RETVAL = 0 ] && rm -f ${PID_FILE} && rm -f ${LOCKFILE}
echo
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${PID_FILE} $NAME
RETVAL=$?
;;
restart|force-reload)
stop
start
;;
*)
N=/etc/init.d/${NAME}
echo "Usage: $N {start|stop|status|restart|force-reload}" >&2
RETVAL=2
;;
esac
exit $RETVAL
``` #################################################################
- chmod 0755 /etc/init.d/graylog2-web
- vi /usr/share/graylog2-web/bin/graylog2-web
```
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
CMD=/usr/share/graylog2-web/bin/graylog2-web-interface
PID_FILE=/var/lib/graylog2-web/application.pid
CONF_FILE=/etc/graylog2/web/web.conf
GRAYLOG_WEB_HTTP_ADDRESS="0.0.0.0"
GRAYLOG_WEB_HTTP_PORT="9000"
[ -f /etc/sysconfig/graylog2-web ] && . /etc/sysconfig/graylog2-web
nohup $GRAYLOG_COMMAND_WRAPPER $CMD -Dconfig.file=${CONF_FILE} \
-Dlogger.file=/etc/graylog2/web/logback.xml \
-Dpidfile.path=$PID_FILE \
-Dhttp.address=$GRAYLOG_WEB_HTTP_ADDRESS \
-Dhttp.port=$GRAYLOG_WEB_HTTP_PORT \
$GRAYLOG_WEB_JAVA_OPTS $GRAYLOG_WEB_ARGS > /var/log/graylog2-web/console.log 2>&1 &
``` #################################################################
- chmod 0755 /usr/share/graylog2-web/bin/graylog2-web
- chkconfig --add graylog2-web
- /etc/init.d/graylog2-web start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment