problem with split log
Dave Cheney
dave at cheney.net
Thu Mar 13 06:01:30 MSK 2008
Try something like this
#!/bin/bash
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"
DATE=$YEAR/$MONTH/$DAY
REDBUBBLE_LOG_ROOT=/var/log/redbubble
NGINX_LOG_ROOT=$REDBUBBLE_LOG_ROOT/nginx
# make path
mkdir -p $NGINX_LOG_ROOT/$DATE
# touch and symlink in new log files
for FILE in $LOG_FILES; do
LOG_FILE=$NGINX_LOG_ROOT/$DATE/$HOSTNAME.$FILE
touch $LOG_FILE
ln -fs $LOG_FILE $NGINX_LOG_ROOT/$FILE
done
# tell nginx to re-open its log files
kill -USR1 `cat /var/run/nginx.pid`
On 13/03/2008, at 1:47 PM, C.F-Win in China F wrote:
> how to split nginx log with cronolog , other method?
>
> just as:
> TransferLog "|/www/sbin/cronolog /www/logs/%Y/%m/%d/
> access.log"
> ErrorLog "|/www/sbin/cronolog /www/logs/%Y/%m/%d/
> errors.log"
More information about the nginx
mailing list