{"id":372,"date":"2010-10-26T14:46:56","date_gmt":"2010-10-26T13:46:56","guid":{"rendered":"http:\/\/blog.robinward.com\/?p=372"},"modified":"2013-08-15T15:18:04","modified_gmt":"2013-08-15T14:18:04","slug":"making-squid-log-timestamps-human-readable","status":"publish","type":"post","link":"https:\/\/robinward.com\/?p=372","title":{"rendered":"Making Squid log timestamps human readable"},"content":{"rendered":"<p>By default, squid uses UTC in its timestamps in its various logs (access.log, store.log, cache.log). Although there are many tools to covert UTC into a human readable format &#8211; its not always practical when running a grep over your logs for troubleshooting.<\/p>\n<p>In order to change this simply add the following line to your squid conf (make sure to remove or comment any exting entries)<\/p>\n<p><code>logformat squid %tl.%03tu %6tr %&gt;a %Ss\/%03Hs %<\/code><\/p>\n<p>The new log youtput will produce something like this:<\/p>\n<p><code>26\/Oct\/2010:15:38:46 +0200.538   4787 y.y.y.y TCP_MISS\/200 41841 GET http:\/\/robinward.com\/ - DIRECT\/x.x.x.x text\/html<\/code><\/p>\n<p>Her is a list of the format codes:<\/p>\n<blockquote><p>%\ta literal % character<br \/>\n&gt;a\tClient source IP address<br \/>\n&gt;A\tClient FQDN<br \/>\n&gt;p\tClient source port<br \/>\nla\tLocal IP address (http_port)<br \/>\nlp\tLocal port number (http_port)<br \/>\nsn\tUnique sequence number per log line entry<br \/>\nts\tSeconds since epoch<br \/>\ntu\tsubsecond time (milliseconds)<br \/>\ntl\tLocal time. Optional strftime format argument<br \/>\ndefault %d\/%b\/%Y:%H:%M:%S %z<br \/>\ntg\tGMT time. Optional strftime format argument<br \/>\ndefault %d\/%b\/%Y:%H:%M:%S %z<br \/>\ntr\tResponse time (milliseconds)<br \/>\ndt\tTotal time spent making DNS lookups (milliseconds)\n<\/p><\/blockquote>\n<p>Use the squid documentary to apply your needs to the logfile:<\/p>\n<p><a href=\"http:\/\/www.squid-cache.org\/Doc\/config\/logformat\/\">http:\/\/www.squid-cache.org\/Doc\/config\/logformat\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>By default, squid uses UTC in its timestamps in its various logs (access.log, store.log, cache.log). Although there are many tools to covert UTC into a human readable format &#8211; its not always practical when running a grep over your logs for troubleshooting. In order to change this simply add the following line to your squid &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/robinward.com\/?p=372\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Making Squid log timestamps human readable&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-372","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/robinward.com\/index.php?rest_route=\/wp\/v2\/posts\/372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/robinward.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robinward.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robinward.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/robinward.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=372"}],"version-history":[{"count":7,"href":"https:\/\/robinward.com\/index.php?rest_route=\/wp\/v2\/posts\/372\/revisions"}],"predecessor-version":[{"id":690,"href":"https:\/\/robinward.com\/index.php?rest_route=\/wp\/v2\/posts\/372\/revisions\/690"}],"wp:attachment":[{"href":"https:\/\/robinward.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robinward.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robinward.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}