Skip to content

Instantly share code, notes, and snippets.

@adyrcz
Created March 24, 2015 03:33
Show Gist options
  • Save adyrcz/2e55f5bf8fc4eab61540 to your computer and use it in GitHub Desktop.
Save adyrcz/2e55f5bf8fc4eab61540 to your computer and use it in GitHub Desktop.
Nginx log rotation based on time
if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})") {
set $year $1;
set $month $2;
set $day $3;
}
access_log /var/log/nginx/access_$year-$month-$day.log;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment