Cassandra Logging Configuration
Configure and analyze Cassandra logs for monitoring and troubleshooting.
Log Files
Section titled “Log Files”| Log File | Purpose | Location |
|---|---|---|
system.log | Main application log | /var/log/cassandra/ |
debug.log | Detailed debug information | /var/log/cassandra/ |
gc.log | Garbage collection | /var/log/cassandra/ |
audit.log | Security audit (if enabled) | /var/log/cassandra/ |
Logback Configuration
Section titled “Logback Configuration”Location
Section titled “Location”/etc/cassandra/logback.xmlBasic Configuration
Section titled “Basic Configuration”<configuration scan="true" scanPeriod="60 seconds"> <jmxConfigurator />
<!-- Console appender --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern> </encoder> </appender>
<!-- System log --> <appender name="SYSTEMLOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${cassandra.logdir}/system.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${cassandra.logdir}/system.log.%d{yyyy-MM-dd}.%i.zip</fileNamePattern> <maxFileSize>50MB</maxFileSize> <maxHistory>7</maxHistory> <totalSizeCap>500MB</totalSizeCap> </rollingPolicy> <encoder> <pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern> </encoder> </appender>
<!-- Debug log --> <appender name="DEBUGLOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${cassandra.logdir}/debug.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${cassandra.logdir}/debug.log.%d{yyyy-MM-dd}.%i.zip</fileNamePattern> <maxFileSize>50MB</maxFileSize> <maxHistory>7</maxHistory> <totalSizeCap>500MB</totalSizeCap> </rollingPolicy> <encoder> <pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern> </encoder> </appender>
<!-- Root logger --> <root level="INFO"> <appender-ref ref="SYSTEMLOG" /> <appender-ref ref="STDOUT" /> </root>
<!-- Debug logger --> <logger name="org.apache.cassandra" level="DEBUG" additivity="false"> <appender-ref ref="DEBUGLOG" /> </logger></configuration>Dynamic Log Level Changes
Section titled “Dynamic Log Level Changes”# Get current levelsnodetool getlogginglevels
# Set log level (temporary)nodetool setlogginglevel org.apache.cassandra DEBUG
# Set specific classnodetool setlogginglevel org.apache.cassandra.db.compaction DEBUG
# Reset to INFOnodetool setlogginglevel org.apache.cassandra INFOImportant Log Messages
Section titled “Important Log Messages”Startup Messages
Section titled “Startup Messages”INFO - Cassandra version: 4.1.3INFO - Starting up...INFO - Hostname: node1.example.com:7000INFO - JVM vendor/version: OpenJDK / 11.0.xINFO - Heap size: 8192/8192 MBINFO - Node /10.0.0.1 is now part of the clusterWarning Signs
Section titled “Warning Signs”# Tombstone warningsWARN - Read 5000 tombstones for query SELECT ...
# Large partition warningsWARN - Compacting large partition keyspace/table:key (150MB)
# GC warningsWARN - GC pause of 1500ms
# Dropped messagesWARN - MUTATION messages were dropped in last 5000msLog Analysis
Section titled “Log Analysis”Common Searches
Section titled “Common Searches”# Find errorsgrep -i "error\|exception" /var/log/cassandra/system.log
# Find warningsgrep -i "warn" /var/log/cassandra/system.log | tail -100
# Compaction activitygrep -i "compaction" /var/log/cassandra/system.log
# GC pausesgrep -i "gc pause" /var/log/cassandra/gc.log
# Slow queriesgrep -i "slow" /var/log/cassandra/system.logCentralized Log Management
AxonOps Monitoring provides centralized log collection and analysis across all Cassandra nodes, with built-in pattern detection and alerting.
Next Steps
Section titled “Next Steps”- Alerting - Alert configuration
- Key Metrics - Metrics reference