Created
October 20, 2016 15:31
-
-
Save codingtiger/3312fa4f15f3bac6abfc6edf1ca5d446 to your computer and use it in GitHub Desktop.
Revisions
-
codingtiger created this gist
Oct 20, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ #!/bin/sh awk 'BEGIN { split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ", months, " ") for (i = 1; i <= 12; i++) m[months[i]] = i }{ split($4,array,/\[|:|\//) year = array[4] month = sprintf("%02d", m[array[3]]) day = array[2] hour = array[5] print > "access."year"-"month"-"day"-"hour".log" }' access.log