Tutorial

How To Find Redis Logs on Ubuntu

Published on March 1, 2016
How To Find Redis Logs on Ubuntu

Logs are essential to troubleshooting your Redis installation. You may ask yourself “Where are my Redis logs?” or “Where does Redis store log files on Ubuntu 14.04?”

With a default apt-get installation on Ubuntu 14.04, Redis log files are located at /var/log/redis/redis-server.log.

To view the last 10 lines:

  1. sudo tail /var/log/redis/redis-server.log

With a default from-source installation on Ubuntu 14.04, Redis log files are located at /var/log/redis_6379.log.

To view the last 10 lines:

  1. sudo tail /var/log/redis_6379.log

The DigitalOcean Redis one-click log files are located at /var/log/redis/redis_6379.log.

To view the last 10 lines:

  1. sudo tail /var/log/redis/redis_6379.log

Checking Archived Log Files

Redis also archives older log files. See a list of the archived logs with:

  1. ls /var/log/redis
Output
redis-server.log  redis-server.log.1.gz

You can gunzip an older file:

sudo gunzip /var/log/redis/redis-server.log.1.gz

Then view its last 10 lines:

sudo tail /var/log/redis/redis-server.log.1

Using find to Search for Logs

If your logs aren’t in either of those locations, you can conduct a more general search using find in the /var/logs directory:

find /var/log/* -name *redis*

Or, search your entire system. This might take a while if you have a lot of files. It will turn up a few permission warnings, which is normal, although we’re avoiding the worst of them in /proc and /sys with the two -prune flags. It will also turn up every file with redis in the name, which includes installation files:

find / -path /sys -prune -o -path /proc -prune -o -name *redis*

Setting the Log Location in redis.conf

The Redis log location is specified in Redis’s configuration file, redis.conf, often located at /etc/redis/redis.conf.

Open that file for editing:

  1. sudo nano /etc/redis/redis.conf

Locate the logfile line:

/etc/redis/redis.conf
logfile /var/log/redis/redis-server.log

Note the location of the log files. You can edit this file path if you want to rename the log file or change its location.

Ubuntu 15.04 and Higher: Checking systemd Logs with journalctl

You may also want to check the logs collected for Redis by systemd. (Ubuntu 15.04 and higher use systemd, although Ubuntu 14.04 defaults to Upstart.) To learn how to use the journalctl command for this purpose, please read this article about journalctl.

Conclusion

If you want to learn more about setting up Redis, please read this article about setting up a Redis cluster.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
3 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Nice introduction to Redis logging management @sharon, it will be shared in our next RedisWeekly tomorrow morning!

You normally don’t need to uncompress archived logs to view them. Normally you should have a programm called zless in your Linux distribution, so you could just use it like so:

zless /var/log/redis/redis-server.log.1.gz

(Press “G” to move to the bottom of the file)

find /var/log/* -name *redis*

should be

find /var/log -name \*redis\*

or

find /var/log -name '*redis*'

unless you are more than 100% sure you don’t have a *redis* file in your current working directory.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more