Skip to content

Instantly share code, notes, and snippets.

@4ndrej
Created August 14, 2020 13:51
Embed
What would you like to do?
nginx yyyy-mm logging without if
http {
#access_log logs/access.log main;
# parse \d{4}-\d{2} from $time_iso8601 into $yyyy_mm
map $time_iso8601 $yyyy_mm {
"~^(?<temp>\d{4}-\d{2})" $temp;
}
server {
listen 80;
server_name _;
location / {
access_log logs/access-80-$yyyy_mm.log;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment