Changing logging locations
Logging locations for DataStax Enterprise (DSE) are set at installation.
Generally, the default logs location is /var/log.
For example, /var/log/cassandra and /var/log/tomcat.
For details, see Default file locations for package and Installer-Services installations or Default file locations for tarball and Installer-No Services installations.
If you use DSE OpsCenter, you can change logging locations for DSE using configuration profiles.
To change logging locations after installation, do the following:
-
Update the log directory location in the
dse-env.shfile or thelogback.xmlfile:dse-env.sh-
To generate all logs in the same location, update the
dse-env.shfile.The location of the
dse-env.shfile depends on your installation type:-
Package installations and installer-services installations:
/etc/dse/dse-env.sh -
Tarball installations and installer-no services installations:
INSTALLATION_LOCATION/bin/dse-env.sh
Add
CASSANDRA_LOG_DIRto thedse-env.shfile, replacingLOG_DIRECTORY_PATHwith the absolute path to your preferred log directory:export CASSANDRA_LOG_DIR="LOG_DIRECTORY_PATH" -
logback.xml-
To generate logs in separate locations, update the
logback.xmlfile. The location of thelogback.xmlfile depends on the type of installation:-
Package installations and installer-services installations:
/etc/dse/cassandra/logback.xml -
Tarball installations and installer-no services installations:
INSTALLATION_LOCATION/resources/cassandra/conf/logback.xml
Replace
${cassandra.logdir}with the absolute path to your preferred log directory in both the<file>and<fileNamePattern>elements for each appender. To use different directories for different log types (system, debug, audit), specify different paths for each appender.The
${cassandra.logdir}variable appears in the following locations:-
SYSTEMLOGappender: Controlssystem.logand its archived files. For example:<!-- Before --> <file>${cassandra.logdir}/system.log</file> <fileNamePattern>${cassandra.logdir}/system.log.%d{yyyy-MM-dd}.%i.zip</fileNamePattern> <!-- After --> <file>LOG_DIRECTORY_PATH/system.log</file> <fileNamePattern>LOG_DIRECTORY_PATH/system.log.%d{yyyy-MM-dd}.%i.zip</fileNamePattern> -
DEBUGLOGappender: Controlsdebug.logand its archived files. For example:<!-- Before --> <file>${cassandra.logdir}/debug.log</file> <fileNamePattern>${cassandra.logdir}/debug.log.%d{yyyy-MM-dd}.%i.zip</fileNamePattern> <!-- After --> <file>LOG_DIRECTORY_PATH/debug.log</file> <fileNamePattern>LOG_DIRECTORY_PATH/debug.log.%d{yyyy-MM-dd}.%i.zip</fileNamePattern> -
AUDITappender: Controlsaudit.logand its archived files. Must be uncommented to apply. For example:<!-- Before --> <file>${cassandra.logdir}/audit.log</file> <fileNamePattern>${cassandra.logdir}/audit.log.%d{yyyy-MM-dd}.%i.zip</fileNamePattern> <!-- After --> <file>LOG_DIRECTORY_PATH/audit.log</file> <fileNamePattern>LOG_DIRECTORY_PATH/audit.log.%d{yyyy-MM-dd}.%i.zip</fileNamePattern>
-
-
Optional: Change the Apache Tomcat® server log locations for DSE Search:
cassandra-env.sh-
To generate all logs in the same location, update the
cassandra-env.shfile. The location of thecassandra-env.shfile depends on the type of installation:-
Package installations and installer-services installations:
/etc/dse/cassandra/cassandra-env.sh -
Tarball installations and installer-no services installations:
INSTALLATION_LOCATION/conf/cassandra-env.sh
Update the
TOMCAT_LOGSenvironment variable, replacingLOG_DIRECTORY_PATHwith the absolute path to your preferred log directory:export TOMCAT_LOGS="LOG_DIRECTORY_PATH" -
logging.properties-
To generate logs in separate locations, update the
logging.propertiesfile.Set the locations in the
resources/tomcat/conf/logging.propertiesfile by replacing${tomcat.logs}with the path to your log directory, and then save the file:1catalina.org.apache.juli.AsyncFileHandler.level = FINE 1catalina.org.apache.juli.AsyncFileHandler.directory = LOG_DIRECTORY_PATH 1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina. 2localhost.org.apache.juli.AsyncFileHandler.level = FINE 2localhost.org.apache.juli.AsyncFileHandler.directory = LOG_DIRECTORY_PATH 2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost. 3manager.org.apache.juli.AsyncFileHandler.level = FINE 3manager.org.apache.juli.AsyncFileHandler.directory = LOG_DIRECTORY_PATH 3manager.org.apache.juli.AsyncFileHandler.prefix = manager. 4host-manager.org.apache.juli.AsyncFileHandler.level = FINE 4host-manager.org.apache.juli.AsyncFileHandler.directory = LOG_DIRECTORY_PATH 4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager. java.util.logging.ConsoleHandler.level = FINE java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
-
Restart DSE.
-
Go to your log directory and verify that DSE is writing logs to the new location.