I am trying to compile a list of IP addresses, timestamps, and useragents to my site. My log format is as follows:
Code:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
Example:
216.54.147.14 - - [24/Feb/2009:08:53:50 -0500] "GET / HTTP/1.1" 200 56 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.04 (hardy) Firefox/3.0.6"
I am able to pull items out separately, but cannot figure out how to do this more efficiently.
awk '{print $1, $4, $5}' gets me the IP address and timestamp.
awk -F\" '{print $6}' gets me the full useragent.
Is there a way to combine the two into one awk command? Or is there a fast/easy way to run the two awks separately and correlate the two lists?