Error with gunzip during logrotate
According to your strace, your problem isn't actually gzip.
Here is why gzip fails.
14972 write(1, "<Here is the content of my prod.log file>"..., 32768) = -1 EPIPE (Broken pipe)
The process is writing to stdout, the actual output of this however is the input to the mail command. If we check this:
14973 execve("/usr/bin/mail", ["/usr/bin/mail", "-s", "/var/www/symfony/app/logs/prod.log", "[email protected]"], ["SHELL=/bin/bash", "TERM=xterm", "USER=root", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41"..., "SUDO_USER=none", "SUDO_UID=1000", "USERNAME=root", "MAIL=/var/mail/root", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "PWD=/home/none", "LANG=en_GB.UTF-8", "SHLVL=1", "SUDO_COMMAND=/bin/bash", "HOME=/root", "LANGUAGE=en_GB:en", "LOGNAME=root", "SUDO_GID=1000", "_=/usr/bin/strace"] <unfinished ...>
14973 <... execve resumed> ) = -1 ENOENT (No such file or directory)
When you try to execute the mail command, it fails because /usr/bin/mail
doesn't exist. The program exits, the stdout
of gzip
returns SIGPIPE
as the other end of the pipe has disappeared. Thus gzip exits with a 1.
What you need to do is install a mail
command. Thats probably either bsd-mailx
on debianesque systems or mailx
on Redhat based ones.