Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis: How to access Redis log file

Tags:

redis

Have Redis setup with ruby on ubuntu server, but can't figure out how to access its log file. Tutorial says it should be here:

/var/log/redis_6379.log 

But can't even find the /var/ folder

like image 246
Christoffer Avatar asked May 02 '13 11:05

Christoffer


People also ask

Where can I find the Redis log file?

The log file will be where the configuration file (usually /etc/redis/redis.conf) says it is :) By default, logfile stdout which probably isn't what you are looking for. If redis is running daemonized, then that log configuration means logs will be sent to /dev/null, i.e. discarded.

How to force Redis to log on the standard output?

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 "redis_log" So the log file is created at /usr/local/var/db/redis/redis_log with the name redis_log

Is it safe to use cat to read Redis log files?

Using cat to read a log file can be a very bad if it is too long (which happens a lot in log files). Using less or tail will be safer This is a known, but someone may find it useful: When looking for signs of crash/issues, Redis log may not help much...it may just show normal op then service online messages.

What is Redis syslog?

Redis is a NoSQL database and is based on key-value storing. If you administrate applications and services, you typically want to discover information about the system service status. The logging of the application is the primary source of this information. Redis offers built-in support for logging with Syslog.


1 Answers

Found it with:

sudo tail /var/log/redis/redis-server.log -n 100 

So if the setup was more standard that should be:

sudo tail /var/log/redis_6379.log -n 100 

This outputs the last 100 lines of the file.

Where your log file is located is in your configs that you can access with:

redis-cli CONFIG GET * 

The log file may not always be shown using the above. In that case use

tail -f `less  /etc/redis/redis.conf | grep logfile|cut -d\  -f2` 
like image 121
Christoffer Avatar answered Sep 18 '22 21:09

Christoffer