To empty logs on a Server, simply use the following command:
> archivo.log
This command empties the logs while correctly preserving permissions, since it does not delete the file. However, because an active process might be writing to the log, it would be advisable to stop the service before emptying the log.
To find out which process or application is writing to the file, you can use the command lsof or fuser, which will display on screen which application is writing to the log:
For example, when running lsof on an Apache log:
lsof access.log
Output similar to the following will be displayed:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME apache2 1270 root 12w REG 8,1 0 2938 access.log
This indicates that the process using the access.log log is apache2.