nodetool getfullquerylog
Displays the current full query logging configuration.
Synopsis
Section titled “Synopsis”nodetool [connection_options] getfullquerylogSee connection options for connection options.
Description
Section titled “Description”nodetool getfullquerylog retrieves and displays the current full query logging (FQL) configuration on a Cassandra node. This command shows whether FQL is enabled, the log path, roll cycle, and other configuration parameters.
Output
Section titled “Output”When Enabled
Section titled “When Enabled”enabled truelog_dir /var/log/cassandra/fqlarchive_commandroll_cycle HOURLYblock truemax_log_size 17179869184max_queue_weight 268435456max_archive_retries 10When Disabled
Section titled “When Disabled”The command shows the configuration from cassandra.yaml even when FQL is disabled. Fields will reflect configured values, not necessarily empty:
enabled falselog_dir /var/log/cassandra/fqlarchive_commandroll_cycle HOURLY...Examples
Section titled “Examples”Basic Usage
Section titled “Basic Usage”nodetool getfullquerylogCheck Specific Field
Section titled “Check Specific Field”# Check if enablednodetool getfullquerylog | grep "enabled"
# Check log pathnodetool getfullquerylog | grep "log_dir"Check Remote Node
Section titled “Check Remote Node”ssh 192.168.1.100 "nodetool getfullquerylog"Output Fields
Section titled “Output Fields”| Field | Description |
|---|---|
enabled | Whether FQL is active |
log_dir | Path where FQL logs are written |
archive_command | Command executed for log archival |
roll_cycle | Log file rotation frequency (MINUTELY, HOURLY, DAILY) |
block | Whether to block queries if logging falls behind |
max_log_size | Maximum total log size in bytes |
max_queue_weight | Maximum in-memory queue size in bytes |
max_archive_retries | Maximum retries for archive command |
Use Cases
Section titled “Use Cases”Verify Configuration After Enable
Section titled “Verify Configuration After Enable”# Enable FQLnodetool enablefullquerylog --path /var/log/cassandra/fql --roll-cycle HOURLY
# Verify configurationnodetool getfullquerylogHealth Check Integration
Section titled “Health Check Integration”#!/bin/bashconfig=$(nodetool getfullquerylog 2>/dev/null)
if echo "$config" | grep -q "enabled.*true"; then echo "FQL Status: ENABLED"
log_dir=$(echo "$config" | grep "log_dir" | awk '{print $2}') block=$(echo "$config" | grep "block" | awk '{print $2}')
echo " Log Directory: $log_dir" echo " Blocking Mode: $block"
if [ -d "$log_dir" ]; then echo " Log Size: $(du -sh $log_dir | awk '{print $1}')" fi
exit 0else echo "FQL Status: DISABLED" exit 0fiMonitor FQL Configuration
Section titled “Monitor FQL Configuration”#!/bin/bashecho "=== Full Query Logging Status ==="echo "Timestamp: $(date)"echo ""
# Get configurationconfig=$(nodetool getfullquerylog 2>/dev/null)echo "Configuration:"echo "$config"
# If enabled, show additional infoif echo "$config" | grep -q "enabled.*true"; then log_dir=$(echo "$config" | grep "log_dir" | awk '{print $2}') max_size=$(echo "$config" | grep "max_log_size" | awk '{print $2}')
echo "" echo "Log Directory Status:" if [ -d "$log_dir" ]; then current_size=$(du -sb $log_dir 2>/dev/null | awk '{print $1}') echo " Current Size: $current_size bytes" echo " Max Size: $max_size bytes" echo " Usage: $(awk "BEGIN {printf \"%.1f\", ($current_size/$max_size)*100}")%" echo " Files: $(ls -1 $log_dir 2>/dev/null | wc -l)" else echo " Log directory does not exist" fifiCluster Configuration Check
Section titled “Cluster Configuration Check”#!/bin/bashecho "=== Cluster FQL Configuration ==="
# Get list of node IPs from local nodetool statusnodes=$(nodetool status | grep "^UN" | awk '{print $2}')
for node in $nodes; do echo "" echo "=== $node ===" ssh "$node" "nodetool getfullquerylog 2>/dev/null"doneVerify Cluster Consistency
Section titled “Verify Cluster Consistency”#!/bin/bash# Get list of node IPs from local nodetool statusnodes=$(nodetool status | grep "^UN" | awk '{print $2}')enabled_count=0disabled_count=0
echo "FQL Status by Node:"for node in $nodes; do config=$(ssh "$node" "nodetool getfullquerylog 2>/dev/null)" if echo "$config" | grep -q "enabled.*true"; then echo "$node: ENABLED" ((enabled_count++)) else echo "$node: DISABLED" ((disabled_count++)) fidone
echo ""echo "Summary:"echo " Enabled: $enabled_count"echo " Disabled: $disabled_count"
if [ "$enabled_count" -gt 0 ] && [ "$disabled_count" -gt 0 ]; then echo "" echo "WARNING: Inconsistent FQL state across cluster!"fiMonitoring Integration
Section titled “Monitoring Integration”Prometheus Exporter
Section titled “Prometheus Exporter”#!/bin/bash# Export FQL config as metrics
config=$(nodetool getfullquerylog 2>/dev/null)
# Enabled statusenabled=$(echo "$config" | grep "enabled" | grep -q "true" && echo "1" || echo "0")echo "cassandra_fql_enabled $enabled"
if [ "$enabled" = "1" ]; then # Blocking mode blocking=$(echo "$config" | grep "block" | grep -q "true" && echo "1" || echo "0") echo "cassandra_fql_blocking $blocking"
# Max log size max_size=$(echo "$config" | grep "max_log_size" | awk '{print $2}') [ -n "$max_size" ] && echo "cassandra_fql_max_log_size_bytes $max_size"
# Current log size log_dir=$(echo "$config" | grep "log_dir" | awk '{print $2}') if [ -d "$log_dir" ]; then current_size=$(du -sb $log_dir 2>/dev/null | awk '{print $1}') echo "cassandra_fql_current_size_bytes $current_size" fifiJSON Output
Section titled “JSON Output”#!/bin/bash# Output FQL config as JSON
config=$(nodetool getfullquerylog 2>/dev/null)
enabled=$(echo "$config" | grep "enabled" | awk '{print $2}')log_dir=$(echo "$config" | grep "log_dir" | awk '{print $2}')roll_cycle=$(echo "$config" | grep "roll_cycle" | awk '{print $2}')block=$(echo "$config" | grep "block" | awk '{print $2}')max_log_size=$(echo "$config" | grep "max_log_size" | awk '{print $2}')
cat <<EOF{ "timestamp": "$(date -Iseconds)", "full_query_logging": { "enabled": $enabled, "log_dir": "$log_dir", "roll_cycle": "$roll_cycle", "block": $block, "max_log_size": $max_log_size }}EOFTroubleshooting
Section titled “Troubleshooting”Command Returns Error
Section titled “Command Returns Error”# Check JMX connectivitynodetool info
# Check Cassandra version (FQL requires 4.0+)nodetool versionEmpty or Unexpected Configuration
Section titled “Empty or Unexpected Configuration”# Compare with cassandra.yamlgrep -A 10 "full_query_logging_options" /etc/cassandra/cassandra.yaml
# Runtime settings may differ from config fileLog Directory Issues
Section titled “Log Directory Issues”# Get log directory from configlog_dir=$(nodetool getfullquerylog | grep "log_dir" | awk '{print $2}')
# Check if directory existsls -la $log_dir
# Check permissionsstat $log_dir
# Check disk spacedf -h $log_dirConfiguration Comparison
Section titled “Configuration Comparison”Runtime vs Persistent
Section titled “Runtime vs Persistent”| Setting Source | Persistence | Scope |
|---|---|---|
enablefullquerylog | Until restart | This node only |
cassandra.yaml | Permanent | All restarts |
# Show both configurationsecho "=== Runtime Configuration ==="nodetool getfullquerylog
echo ""echo "=== cassandra.yaml Configuration ==="grep -A 10 "full_query_logging_options" /etc/cassandra/cassandra.yamlFQL Configuration Report
Section titled “FQL Configuration Report”#!/bin/bashOUTPUT_FILE="/var/log/cassandra/fql_config_$(date +%Y%m%d).log"
echo "=== Full Query Logging Configuration Report ===" | tee $OUTPUT_FILEecho "Generated: $(date)" | tee -a $OUTPUT_FILEecho "Node: $(hostname)" | tee -a $OUTPUT_FILEecho "" | tee -a $OUTPUT_FILE
echo "Current Configuration:" | tee -a $OUTPUT_FILEnodetool getfullquerylog 2>/dev/null | tee -a $OUTPUT_FILE
echo "" | tee -a $OUTPUT_FILE
# If enabled, show log infoconfig=$(nodetool getfullquerylog 2>/dev/null)if echo "$config" | grep -q "enabled.*true"; then log_dir=$(echo "$config" | grep "log_dir" | awk '{print $2}')
echo "Log Directory Contents:" | tee -a $OUTPUT_FILE ls -la $log_dir 2>/dev/null | tee -a $OUTPUT_FILE
echo "" | tee -a $OUTPUT_FILE echo "Log Directory Size:" | tee -a $OUTPUT_FILE du -sh $log_dir 2>/dev/null | tee -a $OUTPUT_FILE
echo "" | tee -a $OUTPUT_FILE echo "Disk Usage:" | tee -a $OUTPUT_FILE df -h $log_dir 2>/dev/null | tee -a $OUTPUT_FILEfiBest Practices
Section titled “Best Practices”Configuration Monitoring
- Verify after enable - Always check config after enabling FQL
- Monitor log growth - Watch
log_dirsize regularly - Check blocking mode - Understand performance implications
- Cluster consistency - Verify same config across nodes
- Compare to limits - Track current size vs
max_log_size - Document settings - Record intended configuration
Configuration Tips
- Runtime settings from
enablefullquerylogdon't persist across restarts - For permanent configuration, update
cassandra.yaml - Consider blocking mode impact on production latency
- Set appropriate
max_log_sizeto prevent disk exhaustion
Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| enablefullquerylog | Enable FQL |
| disablefullquerylog | Disable FQL |
| resetfullquerylog | Reset FQL path |
| getauditlog | View audit log config |