{"id":70,"date":"2014-09-19T04:10:00","date_gmt":"2014-09-19T04:10:00","guid":{"rendered":"http:\/\/onlinelab.info\/2014\/09\/19\/linux-unix-logtop-realtime-log-line-rate-analyser\/"},"modified":"2014-09-19T04:10:00","modified_gmt":"2014-09-19T04:10:00","slug":"linux-unix-logtop-realtime-log-line-rate-analyser","status":"publish","type":"post","link":"https:\/\/www.asianux.org.vn\/index.php\/2014\/09\/19\/linux-unix-logtop-realtime-log-line-rate-analyser\/","title":{"rendered":"Linux \/ Unix logtop: Realtime Log Line Rate Analyser"},"content":{"rendered":"<p><span style=\"background-color: white; color: #888888; float: left; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 3.571em; line-height: 0.76em; margin: 0px; padding: 0.04em 0.12em 0px 0px;\">H<\/span><span style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px;\">ow can I analyze line rate taking log file as input on a Linux system? How do I find the IP flooding my Apache\/Nginx\/Lighttpd web-server on a Debian or Ubuntu Linux?<\/span><br style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin: 0px; padding: 0px;\" \/><span style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin: 0px; padding: 0px;\"><\/span><\/p>\n<div style=\"background-color: white; color: #111111; float: right; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin: 0px 0px 0px 5px; padding: 0px;\">\n<table cellspacing=\"0\" style=\"-webkit-box-shadow: rgb(209, 209, 209) 0px 1px 2px; background: rgb(234, 235, 236); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); box-shadow: rgb(209, 209, 209) 0px 1px 2px; color: #666666; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin: 1px; padding: 0px; text-shadow: rgb(255, 255, 255) 1px 1px 0px;\">\n<tbody style=\"margin: 0px; padding: 0px;\">\n<tr style=\"margin: 0px; padding: 0px 0px 0px 20px; text-align: center;\">\n<th style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(237, 237, 237)), to(rgb(235, 235, 235))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(250, 250, 250); border-top-left-radius: 3px; border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 5px 9px 6px 20px; text-align: left;\">Tutorial details<\/th>\n<th style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(237, 237, 237)), to(rgb(235, 235, 235))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-top-color: rgb(250, 250, 250); border-top-right-radius: 3px; border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 5px 9px 6px;\"><\/th>\n<\/tr>\n<tr style=\"margin: 0px; padding: 0px 0px 0px 20px; text-align: center;\">\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(251, 251, 251)), to(rgb(250, 250, 250))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-left-width: 0px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px 2px 2px 20px; text-align: left;\">Difficulty<\/td>\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(251, 251, 251)), to(rgb(250, 250, 250))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(224, 224, 224); border-left-style: solid; border-left-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px;\"><a href=\"http:\/\/www.cyberciti.biz\/faq\/tutorial-difficulty-level\/easy\/\" style=\"color: #2361a1; font-weight: bold; margin: 0px; padding: 0px; text-decoration: none;\" title=\"See all Easy Linux \/ Unix System Administrator Tutorials\" target=\"_blank\" rel=\"noopener\">Easy<\/a>&nbsp;(<a href=\"http:\/\/www.cyberciti.biz\/faq\/tutorial-difficulty-level\/easy\/feed\/\" style=\"color: #2361a1; font-weight: bold; margin: 0px; padding: 0px; text-decoration: none;\" title=\"See all Easy Linux \/ Unix System Administrator Tutorials via rss feed\" target=\"_blank\" rel=\"noopener\">rss<\/a>)<\/td>\n<\/tr>\n<tr style=\"margin: 0px; padding: 0px 0px 0px 20px; text-align: center;\">\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(248, 248, 248)), to(rgb(246, 246, 246))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-left-width: 0px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px 2px 2px 20px; text-align: left;\">Root privileges<\/td>\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(248, 248, 248)), to(rgb(246, 246, 246))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(224, 224, 224); border-left-style: solid; border-left-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px;\"><a href=\"http:\/\/www.cyberciti.biz\/faq\/how-can-i-log-in-as-root\/\" style=\"color: #2361a1; font-weight: bold; margin: 0px; padding: 0px; text-decoration: none;\" title=\"See how to login as root user\" target=\"_blank\" rel=\"noopener\">Yes<\/a><\/td>\n<\/tr>\n<tr style=\"margin: 0px; padding: 0px 0px 0px 20px; text-align: center;\">\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(251, 251, 251)), to(rgb(250, 250, 250))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-left-width: 0px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px 2px 2px 20px; text-align: left;\">Requirements<\/td>\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(251, 251, 251)), to(rgb(250, 250, 250))); border-bottom-color: rgb(224, 224, 224); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(224, 224, 224); border-left-style: solid; border-left-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px;\">None<\/td>\n<\/tr>\n<tr style=\"margin: 0px; padding: 0px 0px 0px 20px; text-align: center;\">\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(248, 248, 248)), to(rgb(246, 246, 246))); border-bottom-left-radius: 3px; border-bottom-width: 0px; border-left-width: 0px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px 2px 2px 20px; text-align: left;\">Estimated completion time<\/td>\n<td style=\"background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(248, 248, 248)), to(rgb(246, 246, 246))); border-bottom-right-radius: 3px; border-bottom-width: 0px; border-left-color: rgb(224, 224, 224); border-left-style: solid; border-left-width: 1px; border-top-color: rgb(255, 255, 255); border-top-style: solid; border-top-width: 1px; margin: 0px; padding: 2px;\">N\/A<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><span style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px;\">You need to use a tool called logtop. It is a system administrator tool to analyze line rate taking log file as input. It reads on stdin and print a constantly updated result displaying, in columns in the following format:<\/span><\/p>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\"><\/div>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\"><kbd style=\"margin: 0px; padding: 0px;\">Line number, count, frequency, and the actual line<\/kbd><\/div>\n<h2 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">How do install logtop on a Debian or Ubuntu based system?<\/h2>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Simply typ<br \/>\ne the following&nbsp;<a href=\"http:\/\/www.cyberciti.biz\/tips\/linux-debian-package-management-cheat-sheet.html\" style=\"color: #2361a1; margin: 0px; padding: 0px;\" title=\"See Linux\/Unix apt-get command examples for more info\" target=\"_blank\" rel=\"noopener\">apt-get command<\/a>:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\">$ sudo apt-get install logtop<\/code><br style=\"margin: 0px; padding: 0px;\" \/>Sample outputs:<\/div>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;\">Reading package lists... Done<br \/>Building dependency tree<br \/>Reading state information... Done<br \/>The following NEW packages will be installed:<br \/>  logtop<br \/>0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.<br \/>Need to get 15.7 kB of archives.<br \/>After this operation, 81.9 kB of additional disk space will be used.<br \/>Get:1 http:\/\/mirrors.service.networklayer.com\/ubuntu\/ precise\/universe logtop amd64 0.3-1 [15.7 kB]<br \/>Fetched 15.7 kB in 0s (0 B\/s)<br \/>Selecting previously unselected package logtop.<br \/>(Reading database ... 114954 files and directories currently installed.)<br \/>Unpacking logtop (from ...\/logtop_0.3-1_amd64.deb) ...<br \/>Processing triggers for man-db ...<br \/>Setting up logtop (0.3-1) ...<\/pre>\n<h2 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">Syntax<\/h2>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">The syntax is as follows:<\/div>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;\">&nbsp;<br \/>logtop <span style=\"color: #7a0874; font-weight: bold; margin: 0px; padding: 0px;\">[<\/span>OPTIONS<span style=\"color: #7a0874; font-weight: bold; margin: 0px; padding: 0px;\">]<\/span> <span style=\"color: #7a0874; font-weight: bold; margin: 0px; padding: 0px;\">[<\/span>FILE<span style=\"color: #7a0874; font-weight: bold; margin: 0px; padding: 0px;\">]<\/span><br \/><span style=\"color: #7a0874; font-weight: bold; margin: 0px; padding: 0px;\">command<\/span> | logtop<br \/>command1 | filter | logtop<br \/>command1 | filter | logtop <span style=\"color: #7a0874; font-weight: bold; margin: 0px; padding: 0px;\">[<\/span>options<span style=\"color: #7a0874; font-weight: bold; margin: 0px; padding: 0px;\">]<\/span> <span style=\"color: #7a0874; font-weight: bold; margin: 0px; padding: 0px;\">[<\/span><span style=\"color: #c20cb9; font-weight: bold; margin: 0px; padding: 0px;\">file<\/span><span style=\"color: #7a0874; font-weight: bold; margin: 0px; padding: 0px;\">]<\/span><br \/>&nbsp;<\/pre>\n<h2 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">Examples<\/h2>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Here are some common examples of logtop.<\/div>\n<h3 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; font-weight: normal; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">Show the IP address flooding your LAMP server<\/h3>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Type the following command:<\/div>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;\">&nbsp;<br \/><span style=\"color: #c20cb9; font-weight: bold; margin: 0px; padding: 0px;\">tail<\/span> -f www.cyberciti.biz_access.log | <span style=\"color: #c20cb9; font-weight: bold; margin: 0px; padding: 0px;\">cut<\/span> -d<span style=\"color: red; margin: 0px; padding: 0px;\">' '<\/span> -f1 | logtop<br \/>&nbsp;<\/pre>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">Sample outputs:<\/div>\n<div style=\"background-color: white; border: 0px none rgb(221, 221, 221); clear: both; color: #111111; float: none; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; font-style: italic; line-height: 21.9939994812012px; margin: 0px auto 1.571em; padding: 0px; text-align: center; width: 538px;\"><a href=\"http:\/\/s0.cyberciti.org\/uploads\/faq\/2014\/07\/logtop-output.jpg\" style=\"color: #2361a1; margin: 0px; padding: 0px;\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" alt=\"Fig.01: logtop command in action\" class=\"size-full wp-image-69934\" height=\"614\" src=\"http:\/\/s0.cyberciti.org\/uploads\/faq\/2014\/07\/logtop-output.jpg\" style=\"border: 0px; margin: 0px; padding: 0px;\" width=\"528\" title=\"\"><\/a><\/p>\n<div style=\"font-size: 0.857em; line-height: 1.5em; padding: 0px;\">Fig.01: logtop command in action<\/div>\n<\/div>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\"><\/div>\n<h3 style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; font-weight: normal; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;\">See squid cache HIT and MISS log<\/h3>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;\">&nbsp;<br \/><span style=\"color: #c20cb9; font-weight: bold; margin: 0px; padding: 0px;\">tail<\/span> -f cache.log | <span style=\"color: #c20cb9; font-weight: bold; margin: 0px; padding: 0px;\">grep<\/span> -o <span style=\"color: red; margin: 0px; padding: 0px;\">\"HIT<span style=\"color: #000099; font-weight: bold; margin: 0px; padding: 0px;\">|<\/span>MISS\"<\/span> | logtop<br \/>&nbsp;<\/pre>\n<div style=\"background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.9939994812012px; margin-bottom: 1.571em; padding: 0px;\">To see realtime hit \/ miss ratio on some caching software log file, enter:<br style=\"margin: 0px; padding: 0px;\" \/><code style=\"background: none 0px 0px repeat scroll rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;\">tail -f access.log | cut -d' ' -f1 | logtop -s 20000<\/code><br style=\"margin: 0px; padding: 0px;\" \/>The&nbsp;<kbd style=\"margin: 0px; padding: 0px;\">-s<\/kbd>&nbsp;option set logtop to work with the maximum of K lines instead of 10000.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>How can I analyze line rate taking log file as input on a Linux system? How do I find the IP flooding my Apache\/Nginx\/Lighttpd web-server on a Debian or Ubuntu Linux? Tutorial details Difficulty Easy&nbsp;(rss)&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-70","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/70","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/comments?post=70"}],"version-history":[{"count":0,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/70\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/media?parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/categories?post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/tags?post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}