Re: [OT] Cambiar el usuario de los logs en apache
El día 5 de abril de 2011 12:36, fernando sainz
<fernandojose.sainz@gmail.com> escribió:
> El día 5 de abril de 2011 11:56, AngelD <angeld@froga.net> escribió:
>> Tue, 5 Apr 2011, fernando sainz:
>>
>>> El día 5 de abril de 2011 11:23, AngelD <angeld@froga.net> escribió:
>>>>
>>>> Ando intentando que los logs de apache se generen con un usuario
>>>> concreto, en vez de como root. Para ello intento cambiar la línea que me
>>>> genera el log:
>>>>
>>>> CustomLog "|/usr/sbin/rotatelogs /var/log/apache/access_%Y-%m-%d.log
>>>> 50M"
>>>> common
>>>>
>>>> Por:
>>>>
>>>> CustomLog "|/bin/su apache -c \"/usr/sbin/rotatelogs
>>>> /var/log/apache/access_%Y-%m-%d.log 50M\"" common
>>>>
>>>> Dándome un error:
>>>>
>>>> piped log program '/bin/su apache -c "/usr/sbin/rotatelogs
>>>> /var/log/apache/access_%Y-%m-%d.log 50M"' failed unexpectedly
>>>> Usage: /usr/sbin/rotatelogs [-l] <logfile> <rotation time in seconds>
>>>> [offset minutes from UTC] or <rotation size in megabytes>
>>>>
>>> Lo primero que se me ocurre es que en /var/log el usuario apache no
>>> va a tener permisos.
>>
>> Lo primero que se te ocurre no me es válido, porque en
>> /var/log/apache SÍ que tiene permisos el usuario apache.
>>
>> --
>> Saludos --- Angel
>
> Vale, pues ahora mira en los ficheros de configuración de logrotate la
> opción: postrotate
>
>
> Saludos.
>
man logrotate
create mode owner group
Immediately after rotation (before the postrotate script is run)
the log file is created (with the same name as the log file just
rotated). mode specifies the mode for the log file in octal
(the same as chmod(2)), owner specifies the user name who will
own the log file, and group specifies the group the log file
will belong to. Any of the log file attributes may be omitted,
in which case those attributes for the new file will use the
same values as the original log file for the omitted attributes.
This option can be disabled using the nocreate option.
Saludos.
Reply to: