| 1 |
ApacheTop Readme |
|---|
| 2 |
|
|---|
| 3 |
ApacheTop watches a logfile generated by Apache (in standard common or |
|---|
| 4 |
combined logformat, and generates human-parsable output in realtime. |
|---|
| 5 |
|
|---|
| 6 |
See the INSTALL file for ./configure options (there's a few newly added |
|---|
| 7 |
since v0.11) |
|---|
| 8 |
|
|---|
| 9 |
Several commandline options dictate some of its' behaviour: |
|---|
| 10 |
-f logfile |
|---|
| 11 |
Select which file to watch. |
|---|
| 12 |
Specify this option multiple times to watch multiple files |
|---|
| 13 |
|
|---|
| 14 |
-H hits | -T time |
|---|
| 15 |
These options are mutually exclusive. Specify only one, if any at |
|---|
| 16 |
all. They work as follows. ApacheTop maintains a table of |
|---|
| 17 |
information internally containing all the relevant information about |
|---|
| 18 |
the hits it's seen. This table can only be a finite size, so you |
|---|
| 19 |
need to decide how big it's going to be. You have two options. |
|---|
| 20 |
You can either: |
|---|
| 21 |
Use -H to say "remember <this many> hits" |
|---|
| 22 |
or Use -T to say "remember all hits in <this many> seconds" |
|---|
| 23 |
|
|---|
| 24 |
The default (at the moment) is to remember hits for 30 seconds. |
|---|
| 25 |
Setting this too large (whichever option you choose) will cause |
|---|
| 26 |
ApacheTop to use more memory and more CPU time. My experimentation |
|---|
| 27 |
finds that remembering no more than around 5000 requests works well. |
|---|
| 28 |
|
|---|
| 29 |
-q |
|---|
| 30 |
Instructs ApacheTop to keep the querystrings, not remove them |
|---|
| 31 |
|
|---|
| 32 |
-l |
|---|
| 33 |
Instructs ApacheTop to lowercase all URLs, thus /FOO and /foo are |
|---|
| 34 |
treated as the same and accumulate the same statistics. |
|---|
| 35 |
|
|---|
| 36 |
-r |
|---|
| 37 |
Enable resolving of hosts/ips (you need adns!) |
|---|
| 38 |
|
|---|
| 39 |
-s segments |
|---|
| 40 |
Instructs ApacheTop to only keep the first <segments> parts of the |
|---|
| 41 |
path. Trailing slashes are kept if present. Statistics are then |
|---|
| 42 |
merged for each truncated url. |
|---|
| 43 |
This is easiest to demonstrate with examples: |
|---|
| 44 |
-s 2 would produce the following: |
|---|
| 45 |
/media/x.jpg -> /media/x.jpg |
|---|
| 46 |
/media/images/x.jpg -> /media/images/ |
|---|
| 47 |
/media/images/small/x.jpg -> /media/images/ |
|---|
| 48 |
/media/images/big/x.jpg -> /media/images/ |
|---|
| 49 |
Stats for the last three URLs would be merged in this case. |
|---|
| 50 |
|
|---|
| 51 |
-p |
|---|
| 52 |
Instructs ApacheTop to keep the protocol (http:// usually) at the |
|---|
| 53 |
front of its' referrer strings. Normal behaviour is to remove them |
|---|
| 54 |
to give more room to more useful information. |
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
-d secs |
|---|
| 58 |
Set default refresh delay, in seconds. |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
Once it's running, you'll see a display like this: |
|---|
| 62 |
|
|---|
| 63 |
last hit: 09:17:07 atop runtime: 0 days, 00:58:20 09:17:08 |
|---|
| 64 |
All: 638924 reqs ( 182.65/sec) 3433539K ( 981.6K/sec) ( 5.4K/req) |
|---|
| 65 |
2xx: 455415 (71.3%) 3xx: 175745 (27.5%) 4xx: 7746 ( 1.2%) 5xx: 10 ( 0.0%) |
|---|
| 66 |
R ( 30s): 5195 reqs ( 173.17/sec) 25405K ( 846.8K/sec) ( 4.9K/req) |
|---|
| 67 |
2xx: 3447 (66.4%) 3xx: 1715 (33.0%) 4xx: 33 ( 0.6%) 5xx: 0 ( 0.0%) |
|---|
| 68 |
|
|---|
| 69 |
REQS REQ/S KB KB/S URL |
|---|
| 70 |
103 3.4 2983 99.4 / |
|---|
| 71 |
56 1.9 239 8.0 /tickerdata/story2.dat |
|---|
| 72 |
47 1.6 104 3.6 /home/today/patina.js |
|---|
| 73 |
44 1.5 82 2.8 /home/styles/home_d0e2ee.css |
|---|
| 74 |
<snip> |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
The top line displays the time the last hit was seen, how long it's been |
|---|
| 78 |
running, and the current time. |
|---|
| 79 |
|
|---|
| 80 |
The next two lines display information about every single hit ApacheTop has |
|---|
| 81 |
processed in this incarnation. |
|---|
| 82 |
Firstly you see how many hits the data is representing. After that, the |
|---|
| 83 |
average number of hits/second since starting. Following that, the total number |
|---|
| 84 |
of KB witnessed; then the average KB/sec. Finally you see the average KB per |
|---|
| 85 |
request. |
|---|
| 86 |
The next line shows a breakdown of return codes; in this particular example you |
|---|
| 87 |
can see that 71.3% of the hits returned a 2xx code. 27.5% were 3xx, and so on. |
|---|
| 88 |
You also have the actual number of hits in each group. |
|---|
| 89 |
|
|---|
| 90 |
The two lines below this are where the commandline options -h and -t come in. |
|---|
| 91 |
The data in these lines reads the same as the two above them, but this data is |
|---|
| 92 |
only for the hits remembered in ApacheTop's internal table (remember that?). |
|---|
| 93 |
You can see how many seconds of data this represents in the R ( 30s) at the |
|---|
| 94 |
beginning of the line. This is for 30 seconds. These two lines of information |
|---|
| 95 |
are good for a "what is my server doing *right now*?" scenario, while the two |
|---|
| 96 |
above them are good for a picture over the course of a few minutes or hours. |
|---|
| 97 |
|
|---|
| 98 |
Underneath this header, you'll see a list of URLs along with their relevant |
|---|
| 99 |
number of requests, requests per second, kb, and kb per second. |
|---|
| 100 |
This list is generated from the internal table ApacheTop maintains. Thus, in |
|---|
| 101 |
this example, the list is being generated from the last 30 seconds of data. You |
|---|
| 102 |
can see the root page has been requested 103 times in the last 30 seconds, |
|---|
| 103 |
resulting in about 3.4 hits per second. Additionally, those 103 requests have |
|---|
| 104 |
resulted in 2983K of traffic, at an average of 99.4K/second. |
|---|
| 105 |
|
|---|
| 106 |
You can see the individual number of return codes a given item has generated |
|---|
| 107 |
by pressing 'n'. This alternates the numbers columns between hits/bytes |
|---|
| 108 |
and return codes for each item. |
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
You may sort this list by any of the first four columns; first press 's' to |
|---|
| 112 |
enter the 'sort submenu', and then one of the following: |
|---|
| 113 |
r Sort by REQUESTS |
|---|
| 114 |
R Sort by REQUESTS/SECOND |
|---|
| 115 |
b Sort by BYTES |
|---|
| 116 |
B Sort by BYTES/SECOND |
|---|
| 117 |
|
|---|
| 118 |
If you are viewing return code breakdown, then you'll see the following: |
|---|
| 119 |
2 2xx |
|---|
| 120 |
3 3xx |
|---|
| 121 |
4 4xx |
|---|
| 122 |
5 5xx |
|---|
| 123 |
|
|---|
| 124 |
Thus you can see where all your Page Not Founds are coming from and so on. |
|---|
| 125 |
Each sort order is individually maintained, so you can sort by 3xx, and |
|---|
| 126 |
Bytes, for example, then freely switch between number modes (using 'n') |
|---|
| 127 |
without losing either setting. |
|---|
| 128 |
|
|---|
| 129 |
Additionally, you can press d during runtime to switch the list of displayed |
|---|
| 130 |
items between URLs, IPs, and REFERRERs. URLs is the default, and simply |
|---|
| 131 |
groups together hits on your site and provides collated stats for each one. |
|---|
| 132 |
IPs, similarly, groups hits from each IP and shows you stats for it. So you |
|---|
| 133 |
can see how much bandwidth is being used by any given IP. REFERRERs is handy |
|---|
| 134 |
if you want to see where your traffic is coming from. The stats here reflect |
|---|
| 135 |
how many pages/kbytes have been served as a result of a particular referrer. |
|---|
| 136 |
|
|---|
| 137 |
To hold the current screen at any time, press p - statistics will still be |
|---|
| 138 |
generated in the background, but whatever is displayed at the current time |
|---|
| 139 |
is kept onscreen until you press p again. |
|---|
| 140 |
|
|---|
| 141 |
The asterisk beside the URL/IP/Referrer entry in the table can be used to |
|---|
| 142 |
restrict the display to any entry you're interested in. Use Up/Down arrow |
|---|
| 143 |
keys to move the asterisk to an entry you're interested in (you can use 'p' |
|---|
| 144 |
to freeze the display to give you more time to do so) and then press Right |
|---|
| 145 |
arrow to enter the display specific for that item. |
|---|
| 146 |
|
|---|
| 147 |
If the item you expanded is a URL, then IPs and Referrers specific |
|---|
| 148 |
to that URL will be shown; ie, IPs (or hosts) which are visiting |
|---|
| 149 |
that URL, and Referrers which are referring people to that URL. |
|---|
| 150 |
|
|---|
| 151 |
If the item is an IP/Host, then URLs that IP/Host is visiting will |
|---|
| 152 |
be displayed, along with the referrers that IP is coming from. |
|---|
| 153 |
|
|---|
| 154 |
If the item is a Referrer, then URLs and IPs will be shown which |
|---|
| 155 |
have that Referrer. |
|---|
| 156 |
|
|---|
| 157 |
You may turn off any of these subcolumns; press 't' to enter the toggle |
|---|
| 158 |
submenu, then: |
|---|
| 159 |
u Toggles URL subdisplay |
|---|
| 160 |
r Toggles REFERRER subdisplay |
|---|
| 161 |
h Toggles HOSTS subdisplay |
|---|
| 162 |
|
|---|
| 163 |
Thus you can only display HOSTS that are visiting a given URL, etc. |
|---|
| 164 |
Use Left arrow to return to the previous display. |
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
Bug reports and patches are very welcome. Please send any comments on. |
|---|
| 170 |
(if anyone fancies rewriting this README so its a bit more readable..) |
|---|
| 171 |
Chris Elsworth <chris@shagged.org> |
|---|