Centos – How to specify the log file for memcached on RHEL / CentOS

centosmemcachedrhel5

I'm running memcached 1.4.5 on RHEL5.5. I installed this using yum which has installed the standard memcached script in /etc/init.d and the configuration file in /etc/sysconfig/memcached:

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="256"
OPTIONS=""

Everything is working fine with one exception – I can't figure out how to specify the log file location. I'd like to put the log file in /var/log but the help nor the manual specify how to do this.

Is it possible to achieve this using the base scripts?

Best Answer

A suggestion to create a debugging log for memcached in a previous post:

Assuming user nobody has write permissions to /tmp, try the following, noting the position of 2:


memcached -d -m 3072 -l localhost -p 11211 -u nobody -v 2>>/tmp/memcached.log

If user nobody can write to /var/log then I'd assume it's possible to swap out /tmp with /var/log in the above command.

Related Topic