1

In redis, the data is stored in one log file and it keeps getting bigger and bigger. Its size has increased to few GB. How can I store the log file as several files instead of one sorted by date?

Manoj
  • 11
  • Specify the log file name. Also the empty string can be used to force

    Redis to log on the standard output. Note that if you use standard

    output for logging but daemonize, logs will be sent to /dev/null

    logfile "/path/to/redis.log"

    – Manoj Jun 14 '17 at 10:14
  • This is a part of the file "redis.conf" . The log file redis.log where all the data is stored it's size increases.So i want to store data everyday in a new file.How can i do this? Thank you – Manoj Jun 14 '17 at 10:26

1 Answers1

2

You can use logrotate:

Create a file /etc/logrotate.d/redis with something like this:

/var/log/redis/redis-server.log {
    daily
    rotate 12
    compress
    delaycompress
    missingok
    notifempty
    create 644 root root
}

More configuration can be found here

EDIT: If you want a dd-mm-yy format you can use the dateformat directive as explain in this response.

jmlemetayer
  • 156
  • 7