Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am considering Tux as the web server for a new CPAN mirror I'm building. I've got it running and it's very fast but there is one big catch: how am I supposed to rotate the log file?

The log file is configurable, and I am using the default value of /var/log/tux.

One option would be copy-and-truncate; e.g.:

cp /var/log/tux /var/log/tux.1
cat /dev/null > /var/log/tux

The logrotate application can do that for me but since the log file is binary I am concerned that this might lead to corruption at some point.

If it only corrupts one entry I can live with it - my fear is that the whole log file could be lost.

Anyone with experience care to make a suggestion?


share|improve this question
up vote 0 down vote accepted

You could try something like this, which I wrote to roll my nginx logs. I looked for some details on the tux userspace process but couldn't find any way to get it to reopen it's logs, so you may have to resort to stopping and starting the process.


YEAR=`date "+%Y"`
MONTH=`date "+%m"`
DAY=`date "+%d"`

HOSTNAME=`hostname -s`

LOG_FILES="access.log error.log images.log redirect.log ssl.log click.log uploads.log urchin.log user_sites.log"



# make path


# touch and symlink in new log files

for FILE in $LOG_FILES; do
    touch $LOG_FILE

# tell nginx to re-open its log files

kill -USR1 `cat /var/run/`
share|improve this answer
I don't need the date archiving stuff but it does seem to me that the way to go is to rotate and restart Tux. Another way would be to change the log name via /prox/sys/net/tux/ but I haven't tested to check if it will start writing to the newly changed log path without a restart. – XCondE Jun 20 '09 at 2:41

Before I suggest something "TUX has never been an integrated part of the official Linux kernel". Are you sure you want to maintain kernel patches on your own?

Personally I'd try to create a pipe which tux writes to and then use rotatelogs (from apache) to handle that stuff. Maybe even logger so that it uses syslog directly.

rotatelogs can handle time or size based rotations for you, if you don't send the logs to a central logging server I'd use that, if you do send to a central logging server I'd send it to syslog, just let syslog create another socket which tux will write to (preferrably /var/log/tux), and syslog should handle the rest for you...

share|improve this answer
Sorry, I didn't mention we're running Red Hat Enterprise Linux. RH provides the Tux kernel module and user-land stuff so maintaining it is as simple as "yum install tux" and "yum update". – XCondE Jun 19 '09 at 21:45

I'm a bit curious here: What do you expect of incoming requests per second since you need a HTTP engine running inside your kernel? Isnt tinyhttpd fast enough?

share|improve this answer
It may be - I'm not sure RH provides an RPM package for it though. – XCondE Jun 19 '09 at 21:46
RH does not provide packages for tinyhttpd. To answer your question, I'm not expecting a huge demand on the server but I would like to keep the memory and CPU footprint low. – XCondE Jun 19 '09 at 21:51
Well, tiny httpd is extremely cheap on resources. Perhaps you should give it a try? I would try anything but running something inside the kernel. Here are the instructions posted on the tiny httpd website: On Red Hat Linux systems you can use RPM to install thttpd, like so: cd /usr/src/redhat/SOURCES wget rpm -ta thttpd-2.25b.tar.gz rpm -i /usr/src/redhat/RPMS/i386/thttpd-2.25b-1.i386.rpm – pauska Jun 19 '09 at 23:30
Ok, that looks awful. - scroll a bit down. – pauska Jun 19 '09 at 23:31

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.