Change logging locations
Logging locations are automatically set during installation.
The default logs location is /var/log.
For example, /var/log/cassandra.
To change logging locations after installation, update the log directory location in the hcd-env.sh file or the logback.xml file.
Generate all logs in the same location
To generate all logs in the same location, do the following:
-
Add
CASSANDRA_LOG_DIRto thehcd-env.shfile.The location of the
hcd-env.shfile depends on your installation type:-
Package installations:
/etc/hcd/hcd-env.sh -
Tarball installations:
INSTALL_DIRECTORY/bin/hcd-env.shexport CASSANDRA_LOG_DIR="LOG_DIRECTORY_PATH"Replace
LOG_DIRECTORY_PATHwith the absolute path to your preferred log directory.
-
-
Go to your log directory and verify that HCD is writing logs to the new location.
Generate logs in separate locations
To generate logs in separate locations, do the following:
-
Locate the
logback.xmlfile in your installation:The location of the
logback.xmlfile depends on your installation type:-
Package installations:
/etc/hcd/cassandra/logback.xml -
Tarball installations:
INSTALL_DIRECTORY/resources/cassandra/conf/logback.xml
-
-
In the
logback.xmlfile, 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 (if uncommented). 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>
Replace
LOG_DIRECTORY_PATHwith the absolute path to your preferred log directory. -
-
Go to your log directory and verify that HCD is writing logs to the new location.