user3272925
user3272925

Reputation: 83

Save log in separate directory during restart of Cassandra

I am working with Datastax enterprise 4.5. I am looking for a setting that stores old system and console logs of cassandra in some history folder when the service is restarted. Is there a setting (where and how to use it) like that?

Upvotes: 2

Views: 402

Answers (1)

phact
phact

Reputation: 7305

Log rotation config:

You can configure log rotation for system.log in log4j.properties

log4j.appender.R.maxFileSize=20MB
log4j.appender.R.maxBackupIndex=50

And output.log in /etc/logrotate.d/cassandra

/var/log/cassandra/output.log {
  size 10M
  rotate 9
  missingok
  copytruncate
  compress
}

Log files will only grow to the specified size and get a generation number added to the end. I.E. system.log.1, system.log.2

Use the OpsC Backup service:

You can schedule the OpsCenter backup service to perform mv / backup for your logs using the before or after scripts. Usually this is used for backing up sstables but there's no reason why it wouldn't work for logs too if you need.

Use Chrontab:

Alternatively, if you want to move / backup the old logs without OpsC, use chron

Upvotes: 2

Related Questions