Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

nodetool getauditlog

Cassandra 4.1+

This command is available in Cassandra 4.1 and later.

Displays the current audit logging configuration.


Terminal window
nodetool [connection_options] getauditlog

See connection options for connection options.

nodetool getauditlog retrieves and displays the current audit logging configuration on a Cassandra node. This command shows whether auditing is enabled and all associated settings including included/excluded categories, keyspaces, and users.


enabled: true
logger: BinAuditLogger
audit_logs_dir: /var/log/cassandra/audit
archive_command:
included_keyspaces: customer_data,financial
excluded_keyspaces: system,system_schema,system_auth
included_categories: AUTH,DML,DDL,DCL
excluded_categories:
included_users:
excluded_users: monitoring
roll_cycle: HOURLY
block: true
max_queue_weight: 268435456
max_log_size: 17179869184
max_archive_retries: 10

The command shows the configuration from cassandra.yaml even when auditing is disabled. Fields will reflect the configured values, not necessarily empty:

enabled: false
logger: BinAuditLogger
audit_logs_dir: /var/log/cassandra/audit
archive_command:
...

Terminal window
nodetool getauditlog
Terminal window
# Check if enabled
nodetool getauditlog | grep "enabled:"
# Check what categories are being audited
nodetool getauditlog | grep "included_categories"
Terminal window
ssh 192.168.1.100 "nodetool getauditlog"

FieldDescription
enabledWhether audit logging is active
loggerAudit logger class name
audit_logs_dirDirectory where audit logs are stored
archive_commandCommand executed to archive rolled logs
included_keyspacesKeyspaces being audited (if set)
excluded_keyspacesKeyspaces excluded from auditing
included_categoriesAudit event categories being captured
excluded_categoriesCategories excluded from auditing
included_usersUsers being audited (if set)
excluded_usersUsers excluded from auditing
roll_cycleLog file rotation frequency
blockWhether to block operations if log is full
max_queue_weightMaximum queue size in bytes
max_log_sizeMaximum total log size
max_archive_retriesMaximum retries for archive command

Confirm settings after enabling audit logging:

Terminal window
# Enable with specific settings
nodetool enableauditlog --included-categories AUTH,DML --excluded-keyspaces system
# Verify configuration
nodetool getauditlog

Include in operational health checks:

check_audit_status.sh
#!/bin/bash
config=$(nodetool getauditlog 2>/dev/null)
if echo "$config" | grep -q "enabled: true"; then
echo "OK: Audit logging is enabled"
# Check for recommended settings
if echo "$config" | grep -q "AUTH"; then
echo " - AUTH events are being audited"
else
echo " WARNING: AUTH events not being audited"
fi
if echo "$config" | grep -q "block: true"; then
echo " - Blocking mode is enabled (recommended)"
else
echo " - Non-blocking mode (events may be lost)"
fi
exit 0
else
echo "CRITICAL: Audit logging is disabled!"
exit 2
fi

Verify audit configuration meets compliance requirements:

compliance_check.sh
#!/bin/bash
echo "=== Audit Logging Compliance Check ==="
config=$(nodetool getauditlog 2>/dev/null)
issues=0
# Check enabled
if ! echo "$config" | grep -q "enabled: true"; then
echo "FAIL: Audit logging is not enabled"
((issues++))
else
echo "PASS: Audit logging is enabled"
fi
# Check required categories
required_categories=("AUTH" "DML" "DDL" "DCL")
categories=$(echo "$config" | grep "included_categories" | cut -d: -f2)
for cat in "${required_categories[@]}"; do
if echo "$categories" | grep -q "$cat"; then
echo "PASS: $cat category is being audited"
else
echo "FAIL: $cat category is NOT being audited"
((issues++))
fi
done
# Check blocking mode
if echo "$config" | grep -q "block: true"; then
echo "PASS: Blocking mode enabled"
else
echo "WARN: Non-blocking mode - audit events may be lost"
fi
echo ""
if [ $issues -eq 0 ]; then
echo "Compliance check PASSED"
else
echo "Compliance check FAILED - $issues issue(s) found"
fi

Verify audit configuration is consistent across nodes:

check_audit_consistency.sh
#!/bin/bash
echo "=== Cluster Audit Configuration Check ==="# Get list of node IPs from local nodetool status
nodes=$(nodetool status | grep "^UN" | awk '{print $2}')
first_config=""
for node in $nodes; do
config=$(ssh "$node" "nodetool getauditlog 2>/dev/null)"
if [ -z "$first_config" ]; then
first_config="$config"
echo "Reference node: $node"
echo "$config"
echo ""
else
if [ "$config" = "$first_config" ]; then
echo "$node: CONSISTENT"
else
echo "$node: DIFFERS"
echo "Differences:"
diff <(echo "$first_config") <(echo "$config")
fi
fi
done

#!/bin/bash
# Export audit config as metrics
config=$(nodetool getauditlog 2>/dev/null)
# Enabled status
enabled=$(echo "$config" | grep "enabled:" | grep -q "true" && echo "1" || echo "0")
echo "cassandra_audit_logging_enabled $enabled"
# Blocking mode
blocking=$(echo "$config" | grep "block:" | grep -q "true" && echo "1" || echo "0")
echo "cassandra_audit_logging_blocking $blocking"
# Max log size
max_size=$(echo "$config" | grep "max_log_size:" | awk '{print $2}')
[ -n "$max_size" ] && echo "cassandra_audit_max_log_size_bytes $max_size"
#!/bin/bash
# Output audit config as JSON
config=$(nodetool getauditlog 2>/dev/null)
enabled=$(echo "$config" | grep "enabled:" | awk '{print $2}')
logger=$(echo "$config" | grep "logger:" | cut -d: -f2 | xargs)
categories=$(echo "$config" | grep "included_categories:" | cut -d: -f2 | xargs)
block=$(echo "$config" | grep "block:" | awk '{print $2}')
cat <<EOF
{
"timestamp": "$(date -Iseconds)",
"audit_logging": {
"enabled": $enabled,
"logger": "$logger",
"included_categories": "$categories",
"blocking": $block
}
}
EOF

Terminal window
# Check JMX connectivity
nodetool info
# Check Cassandra version (audit logging requires 4.0+)
nodetool version
Terminal window
# Compare with cassandra.yaml settings
grep -A 20 "audit_logging_options" /etc/cassandra/cassandra.yaml
# Runtime changes may differ from config file
# Settings from enableauditlog override cassandra.yaml until restart
Terminal window
# Verify the enable command worked
nodetool getauditlog | grep enabled
# If still showing unexpected config, re-enable
nodetool enableauditlog --included-categories AUTH,DML,DDL,DCL

Setting SourcePersistenceScope
enableauditlogUntil restartThis node only
cassandra.yamlPermanentAll restarts
Terminal window
# Show runtime config
echo "=== Runtime Configuration ==="
nodetool getauditlog
# Show file config
echo ""
echo "=== cassandra.yaml Configuration ==="
grep -A 15 "audit_logging_options" /etc/cassandra/cassandra.yaml

generate_audit_report.sh
#!/bin/bash
OUTPUT_FILE="/var/log/cassandra/audit_config_$(date +%Y%m%d).log"
echo "=== Audit Logging Configuration Report ===" | tee $OUTPUT_FILE
echo "Generated: $(date)" | tee -a $OUTPUT_FILE
echo "Node: $(hostname)" | tee -a $OUTPUT_FILE
echo "" | tee -a $OUTPUT_FILE
echo "Current Configuration:" | tee -a $OUTPUT_FILE
nodetool getauditlog 2>/dev/null | tee -a $OUTPUT_FILE
echo "" | tee -a $OUTPUT_FILE
echo "Audit Log Directory:" | tee -a $OUTPUT_FILE
ls -la /var/log/cassandra/audit/ 2>/dev/null | tee -a $OUTPUT_FILE
echo "" | tee -a $OUTPUT_FILE
echo "Audit Log Size:" | tee -a $OUTPUT_FILE
du -sh /var/log/cassandra/audit/ 2>/dev/null | tee -a $OUTPUT_FILE
echo "" | tee -a $OUTPUT_FILE
echo "Disk Usage:" | tee -a $OUTPUT_FILE
df -h /var/log/cassandra/ | tee -a $OUTPUT_FILE

Configuration Verification

  1. Regular checks - Periodically verify audit configuration
  2. After changes - Always check config after enable/disable
  3. Cluster consistency - Ensure all nodes have same config
  4. Compare to requirements - Verify against compliance needs
  5. Document settings - Keep record of intended configuration
  6. Monitor disk space - Check log growth alongside config

Configuration Tips

  • Runtime settings from enableauditlog don't persist across restarts
  • For permanent configuration, update cassandra.yaml
  • Consider both runtime and file settings when troubleshooting

CommandRelationship
enableauditlogEnable audit logging
disableauditlogDisable audit logging
enablefullquerylogEnable full query logging
getfullquerylogView full query log config