{"id":1575,"date":"2011-08-02T22:43:53","date_gmt":"2011-08-02T22:43:53","guid":{"rendered":"https:\/\/supportex.net\/?p=1575"},"modified":"2019-05-10T20:11:55","modified_gmt":"2019-05-10T18:11:55","slug":"awk-quick-squid-users-traffic-usage","status":"publish","type":"post","link":"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/","title":{"rendered":"AWK: quick way to get squid users traffic usage"},"content":{"rendered":"<p>If you need quick and simple way to get squid users traffic usage you can use this script:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">#!\/bin\/bash\nawk '{\nuser =  $8\ntraffic[user] += $5;\n}\nEND {\nOFS = \"tt\"\nfor (i in traffic) {printf \"%s - tt size:  %10.2f Mbn\", i, ( traffic[i] \/  (1024 * 1024 ) ) }\n}' | column -t | sort -rnk4\n<\/pre>\n<p>Here is an example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">[root@server ~]# head -n 50000 \/var\/log\/squid\/access.log | \/usr\/local\/bin\/traf.sh\nalice - size: 1532.08 Mb\nlinda - size: 11.84 Mb\ncray - size: 9.30 Mb\nfocus - size: 3.05 Mb\nsanta - size: 0.96 Mb\n[root@server ~]#<\/pre>\n<p>Note! It will work only for users with authorization!<\/p>\n<p><strong>Didn&#8217;t find the answer to your question? <a href=\"\/contacts\/\">Ask it<\/a> our administrators to reply we will publish on website.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you need quick and simple way to get squid users traffic usage you can use this script: #!\/bin\/bash awk &#8216;{ user = $8 traffic[user] += $5; } END { OFS = &#8220;tt&#8221; for (i in traffic) {printf &#8220;%s &#8211; tt size: %10.2f Mbn&#8221;, i, ( traffic[i] \/ (1024 * 1024 ) ) } }&#8217;&hellip; <\/p>\n<div class=\"readmore-wrapper\"><a href=\"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/\" class=\"more-link\">Read <\/a><\/div>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[152],"tags":[231,275,234],"class_list":["post-1575","post","type-post","status-publish","format-standard","hentry","category-linux","tag-awk-en","tag-linux","tag-squid"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>AWK: quick way to get squid users traffic usage &#8211; Supportex.NET blog<\/title>\n<meta name=\"description\" content=\"How to awk get squid users traffic usage\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AWK: quick way to get squid users traffic usage &#8211; Supportex.NET blog\" \/>\n<meta property=\"og:description\" content=\"How to awk get squid users traffic usage\" \/>\n<meta property=\"og:url\" content=\"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/\" \/>\n<meta property=\"og:site_name\" content=\"Supportex.NET blog\" \/>\n<meta property=\"article:published_time\" content=\"2011-08-02T22:43:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-10T18:11:55+00:00\" \/>\n<meta name=\"author\" content=\"Oleksii Tykhonov\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oleksii Tykhonov\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/\"},\"author\":{\"name\":\"Oleksii Tykhonov\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"headline\":\"AWK: quick way to get squid users traffic usage\",\"datePublished\":\"2011-08-02T22:43:53+00:00\",\"dateModified\":\"2019-05-10T18:11:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/\"},\"wordCount\":59,\"commentCount\":0,\"keywords\":[\"awk\",\"linux\",\"squid\"],\"articleSection\":[\"linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/\",\"url\":\"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/\",\"name\":\"AWK: quick way to get squid users traffic usage &#8211; Supportex.NET blog\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\"},\"datePublished\":\"2011-08-02T22:43:53+00:00\",\"dateModified\":\"2019-05-10T18:11:55+00:00\",\"author\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"description\":\"How to awk get squid users traffic usage\",\"breadcrumb\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/supportex.net\/blog\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AWK: quick way to get squid users traffic usage\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\",\"url\":\"https:\/\/supportex.net\/blog\/en\/\",\"name\":\"Supportex.NET blog\",\"description\":\"Server and network management company\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\",\"name\":\"Oleksii Tykhonov\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"caption\":\"Oleksii Tykhonov\"},\"url\":\"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"AWK: quick way to get squid users traffic usage &#8211; Supportex.NET blog","description":"How to awk get squid users traffic usage","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/","og_locale":"en_US","og_type":"article","og_title":"AWK: quick way to get squid users traffic usage &#8211; Supportex.NET blog","og_description":"How to awk get squid users traffic usage","og_url":"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/","og_site_name":"Supportex.NET blog","article_published_time":"2011-08-02T22:43:53+00:00","article_modified_time":"2019-05-10T18:11:55+00:00","author":"Oleksii Tykhonov","twitter_misc":{"Written by":"Oleksii Tykhonov","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/#article","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/"},"author":{"name":"Oleksii Tykhonov","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"headline":"AWK: quick way to get squid users traffic usage","datePublished":"2011-08-02T22:43:53+00:00","dateModified":"2019-05-10T18:11:55+00:00","mainEntityOfPage":{"@id":"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/"},"wordCount":59,"commentCount":0,"keywords":["awk","linux","squid"],"articleSection":["linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/","url":"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/","name":"AWK: quick way to get squid users traffic usage &#8211; Supportex.NET blog","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/en\/#website"},"datePublished":"2011-08-02T22:43:53+00:00","dateModified":"2019-05-10T18:11:55+00:00","author":{"@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"description":"How to awk get squid users traffic usage","breadcrumb":{"@id":"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/supportex.net\/blog\/2011\/08\/awk-quick-squid-users-traffic-usage\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/supportex.net\/blog\/en\/"},{"@type":"ListItem","position":2,"name":"AWK: quick way to get squid users traffic usage"}]},{"@type":"WebSite","@id":"https:\/\/supportex.net\/blog\/en\/#website","url":"https:\/\/supportex.net\/blog\/en\/","name":"Supportex.NET blog","description":"Server and network management company","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251","name":"Oleksii Tykhonov","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","caption":"Oleksii Tykhonov"},"url":"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/"}]}},"_links":{"self":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/1575","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/comments?post=1575"}],"version-history":[{"count":2,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/1575\/revisions"}],"predecessor-version":[{"id":3223,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/1575\/revisions\/3223"}],"wp:attachment":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/media?parent=1575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/categories?post=1575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/tags?post=1575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}