Skip to content

Instantly share code, notes, and snippets.

@johnroyer
Created August 28, 2015 04:45
Show Gist options
  • Save johnroyer/b06abe412b51dd1f9544 to your computer and use it in GitHub Desktop.
Save johnroyer/b06abe412b51dd1f9544 to your computer and use it in GitHub Desktop.
BEGIN {
}
{
split($0, token, " ");
remoteIp = token[1];
httpStauts = token[9];
# time
split($0, timequote, "[");
split(timequote[2], timequote2, "]");
time = timequote2[1];
# header
split($0, quote, "\"");
split(quote[2], header, " ");
method = header[1];
path = header[2];
protocol = header[3];
# user agent
agent = quote[6];
print time, "\t", remoteIp, "\t", method, "\t", path, "\t", protocol, "\t", agent;
}
END {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment