Skip to content

Instantly share code, notes, and snippets.

@sheeplogh
Created April 9, 2013 10:57
Show Gist options
  • Save sheeplogh/5344821 to your computer and use it in GitHub Desktop.
Save sheeplogh/5344821 to your computer and use it in GitHub Desktop.
Akamai's standard log format (esw3c (W3c–style) Log Format) to combined(JST)
#!/bin/sh
LANG=C
/bin/gawk -F"\t" '$0 !~ /^#/ {
## make epochtime from timestamp
split($1, d, "-");
split($2, t, ":");
timestamp=d[1]" "d[2]" "d[3]" "t[1]" "t[2]" "t[3];
epochtime=mktime(timestamp);
## GMT ==> JST
epochtime+=32400;
## make apache format timestamp
timestamp_jst=strftime("[%d/%b/%Y:%H:%M:%S %z]", epochtime);
## print in combined like format
print $3,"-","-",timestamp_jst,"\""$4,$5,"HTTP/1.1""\"",$6,$7,$9,$10,$8;
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment