{"id":1132,"date":"2009-10-21T18:31:46","date_gmt":"2009-10-21T22:31:46","guid":{"rendered":"http:\/\/www.ezrasf.com\/wplog\/?p=1132"},"modified":"2009-11-05T14:56:40","modified_gmt":"2009-11-05T18:56:40","slug":"useful-user-agents","status":"publish","type":"post","link":"https:\/\/www.ezrasf.com\/wplog\/2009\/10\/21\/useful-user-agents\/","title":{"rendered":"Useful User Agents"},"content":{"rendered":"<p>Rather than depend on end users to accurately report the browser used, I look for the user-agent in the web server logs. (Yes, I know it can be spoofed. Power users would be trying different things to resolve their own issues not coming to us.)<\/p>\n<p>Followers of this blog may recall I changed the Weblogic config.xml to <a href=\"http:\/\/www.ezrasf.com\/wplog\/2009\/02\/26\/better-cevista-web-server-log\/\">record user agents to the webserver.log<\/a>.<\/p>\n<p>One trick I use is the double quotes in awk to identify just the user agent. This information is then sorting by name to count (uniq -c) how many of each is present. Finally, I sort again by number with the largest at the top to see which are the most common.<\/p>\n<blockquote><p>grep &lt;term&gt; webserver.log | awk -F\\&#8221; &#8216;{print $2}&#8217; | sort | uniq -c | sort -n -r<\/p><\/blockquote>\n<p>This is what I will use looking for a specific user. If I am looking at a wider range, such as the user age for hits on a page, then I probably will use the head command to look at the top 20.<\/p>\n<p>A &#8220;feature&#8221; of this is getting the build (Firefox 3.011) rather than just the version (Firefox 3). For getting the version, I tend to use something more like this to count the found version out of the log.<\/p>\n<blockquote><p>grep &lt;term&gt; webserver.log | awk -F\\&#8221; &#8216;{print $2}&#8217; |\u00c2\u00a0grep -c &#8216;&lt;version&gt;&#8217;<\/p><\/blockquote>\n<p>I have yet to see many CE\/Vista URIs with the names of web browsers. So these are the most common versions one would likely find (what to grep &#8211; name &#8211; notes):<\/p>\n<ol>\n<li>MSIE # &#8211; Microsoft Internet Explorer &#8211; I&#8217;ve seen 5 through 8 in the last few months.<\/li>\n<li>Firefox # &#8211; Mozilla Firefox &#8211; I&#8217;ve seen 2 through 3.5. There is enough difference between 3 and 3.5 (also 2 and 2.5) I would count them separately.<\/li>\n<li>Safari &#8211; Apple\/WebKit &#8211; In searching for this one, I would add to the search a &#8216;grep -v Chrome&#8217; or to eliminate Google Chrome user agents.<\/li>\n<li>Chrome # &#8211; Google Chrome &#8211; Only versions 1 and 2.<\/li>\n<\/ol>\n<p>Naturally there many, many others. It surprised me to see iPhone and Android on the list.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Rather than depend on end users to accurately report the browser used, I look for the user-agent in the web server logs. (Yes, I know it can be spoofed. Power users would be trying different things to resolve their own issues not coming to us.) Followers of this blog may recall I changed the Weblogic [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[22],"tags":[990,376,329,434,991,772,657,244,3054,219,263,75,254,814,97,349,813,3059,231,277,137,862,389,3035,262,377,502,283,112,554,501,479,104,362],"class_list":["post-1132","post","type-post","status-publish","format-standard","hentry","category-bbvista","tag-blackboard-cevista","tag-browser","tag-cevista","tag-chrome","tag-environmental-protection-agency","tag-ezra","tag-fire","tag-firefox","tag-google","tag-hits","tag-information","tag-internet","tag-internet-explorer","tag-iphone","tag-issues","tag-logic","tag-logs","tag-microsoft","tag-mozilla","tag-name","tag-names","tag-personal-learning-environment","tag-port","tag-quotes","tag-search","tag-server","tag-user-agent","tag-user-interface","tag-users","tag-version","tag-web-browser","tag-web-server","tag-weblogic","tag-xml"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1rUBW-ig","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/posts\/1132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/comments?post=1132"}],"version-history":[{"count":0,"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/posts\/1132\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/media?parent=1132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/categories?post=1132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ezrasf.com\/wplog\/wp-json\/wp\/v2\/tags?post=1132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}