Logrotate

530 views
Skip to first unread message

Darvin Denmian

unread,
Oct 19, 2012, 2:42:10 PM10/19/12
to redi...@googlegroups.com
Hi,

What is the best way to rotate redis log file?

Regards.

manohar h t

unread,
Oct 19, 2012, 2:50:52 PM10/19/12
to redi...@googlegroups.com

Use syslog option in redis config and logrotate.

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.

Josiah Carlson

unread,
Oct 19, 2012, 2:51:18 PM10/19/12
to redi...@googlegroups.com
There is no "best way", as Redis doesn't currently do log rotation.

If you are careful, you can replace the file handle with a debugger,
but it's nasty.

Redis also allows you to send logs out to syslog, which you can then
use to handle log storage, rotation, etc.

- Josiah

Darvin Denmian

unread,
Oct 19, 2012, 2:53:15 PM10/19/12
to redi...@googlegroups.com
Hi,

I'll try to use the "syslog" option.

Thanks for all replies.

Salvatore Sanfilippo

unread,
Oct 19, 2012, 7:01:24 PM10/19/12
to redi...@googlegroups.com
Hi Darvin,

since Redis is not log-intensive (there is no case where requests are
logged) it reopens the file *every time* it adds a log line.
This means that log rotation is very easy to perform as you don't need
to send any special signal to Redis.

Just move the file away with "mv" and a new one is generated by Redis
for the first log line.

Or you can use syslog as many said.

Salvatore
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
>



--
Salvatore 'antirez' Sanfilippo
open source developer - VMware
http://invece.org

Beauty is more important in computing than anywhere else in technology
because software is so complicated. Beauty is the ultimate defence
against complexity.
— David Gelernter

sravs

unread,
Jun 13, 2018, 8:24:52 PM6/13/18
to Redis DB
Would this be a good logrotate configuration for redis ?

/var/log/redis/*.log {
  rotate 7
  weekly
  dateext
  size=+1M
  compress
  notifempty
  missingok
  create 0660 redis redis
}
Reply all
Reply to author
Forward
0 new messages