Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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:


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?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

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.

share|improve this answer
this is a 'hack' and is not the authentic solution for RHEL/CentOS. Preferred solution is OPTIONS option in /etc/sysconfig/memcached, the official RHEL package settings file location (detailed by @Ben-Johnson below) –  Joey T May 1 '13 at 23:55

Modify the OPTIONS line in /etc/sysconfig/memcached adding ">> /var/log/memcached 2>&1" on the end. IE

OPTIONS="-vv >> /var/log/memcached 2>&1"
share|improve this answer
this should be marked as actual solution, as it is the RHEL/CentOS specific solution –  Joey T May 1 '13 at 23:53
I'd suggest appending ".log" to that log file name to make it memcached.log so logrotate default config will rotate the log. –  Larry Silverman Nov 11 '14 at 16:03

Memcached doesn't provide a commandline option for log file location. On Ubuntu, there's a wrapper script called start-memcached which parses an /etc/memcached.conf which contains a logfile parameter. Unfortunately, this doesn't seem to exist on CentOS/RHEL. I think you'd have to modify the init script to accomplish what you want. It does seem to be a bit of an oversight - a quick googling shows that other people have this problem too, so maybe its something they'll fix soon (or have fixed already and I'm not aware of). Or you could try the startup scripts from Ubuntu.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.