Christoffer
Christoffer

Reputation: 7953

How to access Redis log file

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

Upvotes: 84

Views: 273604

Answers (6)

Hamid Haghdoost
Hamid Haghdoost

Reputation: 867

I recommend you to use redis-cli monitoring tool. Simple type the following command:

redis-cli monitor

It gives you a real-time access log which helps you troubleshoot the problems and...

Upvotes: 12

Kanagavelu Sugumar
Kanagavelu Sugumar

Reputation: 19260

vi /usr/local/etc/redis.conf

Look for dir, logfile

# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir /usr/local/var/db/redis/



# 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 "redis_log"

So the log file is created at /usr/local/var/db/redis/redis_log with the name redis_log

You can also try MONITOR command from redis-cli to review the number of commands executed.

Upvotes: 16

Christoffer
Christoffer

Reputation: 7953

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`

Upvotes: 100

blimmer
blimmer

Reputation: 2486

You can also login to the redis-cli and use the MONITOR command to see what queries are happening against Redis.

Upvotes: 49

Aman Aggarwal
Aman Aggarwal

Reputation: 18459

Check your error log file and then use the tail command as:

tail -200f /var/log/redis_6379.log

or

 tail -200f /var/log/redis.log

According to your error file name..

Upvotes: -1

glarrain
glarrain

Reputation: 8449

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.

Summary: set logfile /path/to/my/log/file.log in your config and redis logs will be written to that file.

Upvotes: 13

Related Questions