Change logging locations
Logging locations are set during installation.
Generally, the default logs location is /var/log.
For example, /var/log/cassandra.
To change logging locations, after installation, do the following:
-
Update the log directory location in the
hcd-env.shfile or thelogback.xmlfile.To generate all logs in the same location, update the
hcd-env.shfile. To generate logs in separate locations, update thelogback.xmlfile.-
hcd-env.sh -
logback.xml
Add
CASSANDRA_LOG_DIRto thehcd-env.shfile:export CASSANDRA_LOG_DIR="LOG_DIRECTORY_PATH"Replace
LOG_DIRECTORY_PATHwith the absolute path to your preferred log directory.Where is the
hcd-env.shfile located?The location of the
hcd-env.shfile depends on your installation type:-
Package installations and installer-services installations:
/etc/hcd/hcd-env.sh -
Tarball installations and installer-no services installations:
INSTALLATION_LOCATION/bin/hcd-env.sh
Replace
${cassandra.logdir}with the absolute path to your preferred log directory in both the<file>and<fileNamePattern>elements for each appender.The
${cassandra.logdir}variable appears in the following locations:-
SYSTEMLOGappender: Controlssystem.logand its archived files -
DEBUGLOGappender: Controlsdebug.logand its archived files -
AUDITappender: Controlsaudit.logand its archived files (if uncommented)
Change the
system.loglocation<!-- 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>Replace
LOG_DIRECTORY_PATHwith the absolute path to your preferred log directory.Change the
debug.loglocation<!-- 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>Replace
LOG_DIRECTORY_PATHwith the absolute path to your preferred log directory.Change the
audit.loglocation<!-- 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>Replace
LOG_DIRECTORY_PATHwith the absolute path to your preferred log directory.Where is the
logback.xmlfile located?The location of the
logback.xmlfile depends on the type of installation:-
Package installations and installer-services installations:
/etc/hcd/cassandra/logback.xml -
Tarball installations and installer-no services installations:
INSTALLATION_LOCATION/resources/cassandra/conf/logback.xml
To use different directories for different log types (system, debug, audit), specify different paths for each appender.
-
-
Go to your log directory and verify that HCD is writing logs to the new location.