linuxでnginxログ内容を分ける
save.sh
#!/bin/bash
#
#Nginx Log の保存Path
logs_path="/data1/logs/"
mkdir -p ${logs_path}$(date -d “%Y")/$(date -d “%m")/
mv ${logs_path}access.log ${logs_path}$(date -d “%Y")/$(date -d “%m")/access_$(date -d “%Y%m%d").log
kill -USR1 'cat /usr/local/nginx/nginx.pid’
crontab設定
crontab -e
00 00 * * * /bin/bash ShellPath/../save.sh