Skip to main content

3.29 – Send logs to syslog

SparkView can collect and forward logs under Linux via syslog. This requires a few adjustments on the part of SparkView and on the server.

Adjustments SparkView:

Create the file logging.properties in the SparkView root directory. You can also copy an existing one from the JRE/lib directory and customize it by adding the following lines at the end:

.level= INFO
handlers= java.util.logging.ConsoleHandler, com.agafua.syslog.SyslogHandler
# Syslog logger
com.agafua.syslog.SyslogHandler.transport = udp
com.agafua.syslog.SyslogHandler.facility = local0
com.agafua.syslog.SyslogHandler.port = 514
com.agafua.syslog.SyslogHandler.hostname = vmuser-xubuntu1604

Then add the Java VM argument to the command that starts SparkView:

-Djava.util.logging.config.file=yourSparkViewFolder/logging.properties

Adjustments Server (Ubuntu):
  1. Edit the file "/etc/rsyslog.conf" and comment/activate the following two lines:
    module(load="imudp")
    input(type="imudp" port="514")
    
  2. Go to the directory "/etc/rsyslog.d" and create a new file "60-java.conf" (the name can be chosen arbitrarily) with the following content:
    local0.* /var/log/gateway.log
    
  3. Restart the syslog service: sudo service rsyslog restart