最新消息:

Squid高级日志分析

未分类 admin 3313浏览 0评论

我们用squid,少不了对squid日志的分析,但别的软件太麻烦,现在有个不错的好东东acalar.

acalar的确是满好用的squid日志分析工具,强力推荐给有管理的兄弟—真是居家旅行、杀人灭口必备啊.

命令超级容易.这是一个命令行的工具,只要给这个小脚本放到你的系统中,用下面的命令运行就好了.

scalar下载地址

scalar

scalar使用方法

[root@kvm-squid ~]# awk -f scalar.txt /var/log/squid/access.log

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~  SCALAR (Squid Cache Advanced Log Analyzer & Reporter), Version 0.96  ~~~~
~~~~                                                                       ~~~~
~~~~  (C) 2003-4 by Yuri N. Fominov, YuriF@risk.az, http://scalar.risk.az  ~~~~
~~~~  SCALAR has no warranty and it is completely free, so you are welcome ~~~~
~~~~  to re-distribute this pretty useful piece of software. Good Luck2All ~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~ Analysis Headlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  Log Start Time [07-12-2012 00:58:48]
    Log End Time [09-12-2012 17:52:34]
  Lines Analyzed   112.360K

 Unique Clients: 8

     In Traffic:    1.033 GB
    Out Traffic:    1.238 GB
  ------------------------------------
  Saved Traffic:  209.489 MB   16.52 %

~~~ Requests By Hours ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 21.4K                          ==
 20.3K                          ==
 19.3K                          ==
 18.2K                          ==
 17.1K                          ==
 16.1K                          ==
 15.0K                          ==
 13.9K                          ==
 12.8K                          ==
 11.8K                          ==
 10.7K                          ==       ==
  9.6K                          ==       ==
  8.6K                          == ==    ==
  7.5K                          == ==    ==
  6.4K                          == ==    ==
  5.3K                       == == ==    ==    ==
  4.3K                       == == ==    ==    ==
  3.2K                 == == == == ==    ==    ==
  2.1K                 == == == == == == == == ==
  1.1K                 == == == == == == == == ==
_______________________________________________________________________________
  Hours: 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

Maximum Requests:  21.403K/hour,      356 /min,    5.9/sec.
Average Requests:   2.767K/hour,       46 /min,    0.8/sec.
Minimum Requests:       0 /hour,        0 /min,    0.0/sec.

~~~ Traffic by Hours ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

136.2MB                            ==
129.4MB                      ==    ==
122.6MB                      ==    ==
115.8MB                      ==    ==
108.9MB                      ==    ==
102.1MB                      ==    ==    ==    ==
 95.3MB                      == == ==    ==    ==
 88.5MB                      == == ==    ==    ==
 81.7MB                      == == ==    == == ==
 74.9MB                      == == ==    == == ==
 68.1MB                      == == ==    == == ==
 61.3MB                      == == ==    == == ==
 54.5MB                      == == ==    == == ==
 47.7MB                      == == ==    == == ==
 40.9MB                   == == == ==    == == ==
 34.0MB                == == == == == == == == ==
 27.2MB                == == == == == == == == ==
 20.4MB                == == == == == == == == ==
 13.6MB                == == == == == == == == ==
  6.8MB                == == == == == == == == ==
_______________________________________________________________________________
  Hours: 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

Maximum Xfers: 136.181 MB/hour,    2.270 MB/min,  38.736 KB/sec [ 310 kbps]
Average Xfers:  32.587 MB/hour,  556.147 KB/min,   9.269 KB/sec [  74 kbps]
Minimum Xfers:       0  B/hour,        0  B/min,       0  B/sec [   0 kbps]

~~~ File Extensions Report ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-------|------ R E Q U E S T S  --------|----------- T R A F F I C -----------|
 Ext.  |  total | misses |  hits  |hit% |   total  |  misses  |   hits   |hit%|
-------|--------|--------|--------|-----|----------|----------|----------|----|
<QUERY>  39.949K  35.136K   4.813K  12%  351.437 MB 305.556 MB  45.880 MB  13%
gif      34.897K   1.192K  33.705K  97%   36.267 MB   8.181 MB  28.086 MB  77%
jpg      10.339K   7.118K   3.221K  31%  402.789 MB 329.867 MB  72.923 MB  18%
js        3.587K     604    2.983K  83%   38.716 MB   7.058 MB  31.658 MB  82%
/         3.439K   2.528K     911   26%   28.998 MB  17.316 MB  11.682 MB  40%
png       2.635K     965    1.670K  63%   21.319 MB  13.624 MB   7.694 MB  36%
css         646      168      478   74%    3.724 MB   1.737 MB   1.987 MB  53%
html        593      195      398   67%    2.137 MB   1.369 MB 786.480 KB  36%
swf         549      329      220   40%   19.731 MB  13.913 MB   5.818 MB  29%
htm         487       69      418   86%    2.100 MB   1.055 MB   1.045 MB  50%
cab         446      446        0    0%   12.009 MB  12.009 MB       0  B   0%
cur         285        1      284  100%  391.850 KB     790  B 391.078 KB 100%
php         270      270        0    0%  549.073 KB 549.073 KB       0  B   0%
mp3         265      265        0    0%   89.320 MB  89.320 MB       0  B   0%
[other]     232      224        8    3%    2.776 MB   2.100 MB 692.154 KB  24%
xml         228       68      160   70%  725.234 KB 135.818 KB 589.416 KB  81%
shtml       189      189        0    0%    4.090 MB   4.090 MB       0  B   0%
ini         182      169       13    7%    0.957 MB 972.608 KB   6.890 KB   1%
ico         177       99       78   44%  469.273 KB 286.208 KB 183.065 KB  39%
exe         172      172        0    0%   50.022 MB  50.022 MB       0  B   0%
do          169      169        0    0%  188.326 KB 188.326 KB       0  B   0%
search       72       72        0    0%  124.929 KB 124.929 KB       0  B   0%
ax           68       68        0    0%    2.645 MB   2.645 MB       0  B   0%
zip          66       66        0    0%   30.736 MB  30.736 MB       0  B   0%
txt          46       40        6   13%  144.365 KB  14.938 KB 129.427 KB  90%
dat          40       40        0    0%  464.739 KB 464.739 KB       0  B   0%
jpeg         25       25        0    0%    1.730 MB   1.730 MB       0  B   0%
x            23       23        0    0%   38.075 KB  38.075 KB       0  B   0%
crl          21       18        3   14%   25.754 KB  24.900 KB     874  B   3%
jsps         21       21        0    0%   25.672 KB  25.672 KB       0  B   0%
aspx         21       21        0    0%  393.021 KB 393.021 KB       0  B   0%
<LONG.>      19       18        1    5%    4.356 MB   4.356 MB     281  B   0%
swf,u        18       18        0    0%   19.072 KB  19.072 KB       0  B   0%
ver          15       15        0    0%   23.053 KB  23.053 KB       0  B   0%
cgi          15       15        0    0%   25.979 KB  25.979 KB       0  B   0%
yl           15       15        0    0%    3.701 KB   3.701 KB       0  B   0%
ashx         14       14        0    0%   81.430 KB  81.430 KB       0  B   0%
bmp          14       14        0    0%   12.809 MB  12.809 MB       0  B   0%
up           13       13        0    0%    3.047 KB   3.047 KB       0  B   0%
rm            9        9        0    0%  147.515 KB 147.515 KB       0  B   0%
dwr           9        9        0    0%   22.105 KB  22.105 KB       0  B   0%
dll           9        9        0    0%    4.381 KB   4.381 KB       0  B   0%
trt           8        8        0    0%   25.609 KB  25.609 KB       0  B   0%
json          8        8        0    0%   39.594 KB  39.594 KB       0  B   0%
gz            7        7        0    0%  849.575 KB 849.575 KB       0  B   0%
aac           7        7        0    0%    8.271 MB   8.271 MB       0  B   0%
dif           7        7        0    0%   32.643 KB  32.643 KB       0  B   0%
kdc           6        6        0    0%  378.391 KB 378.391 KB       0  B   0%
flv           5        5        0    0%   61.558 MB  61.558 MB       0  B   0%
klz           4        4        0    0%  103.261 KB 103.261 KB       0  B   0%
================|========|========|=====|==========|==========|==========|====|
TOTALS: 100.341K  50.971K  49.370K  49%    1.166 GB   0.961 GB 209.489 MB  18%

-----------------------|-- R E Q U E S T S ---|-------- T R A F F I C --------|
 Content Type          |  total |  hits  |hit%|  total   |   hits   |hit%|%VOL|
-----------------------|--------|--------|----|----------|----------|----|----|
Images/Graphics & Flash  48.654K  38.894K  80% 495.122 MB 114.700 MB  23%  41%
<QUERY>                  39.949K   4.813K  12% 351.437 MB  45.880 MB  13%  29%
Java, VBS & CSS           4.262K   3.461K  81%  42.504 MB  33.645 MB  79%   4%
/ -any content possible   3.439K     911   26%  28.998 MB  11.682 MB  40%   2%
Web Pages: Static         1.497K     976   65%   9.035 MB   2.389 MB  26%   1%
[other]                   1.129K     309   27%  73.662 MB   1.066 MB   1%   6%
Media: Audio                514      160   31%  90.412 MB 589.416 KB   1%   8%
Software Updates            455        0    0%  12.013 MB       0  B   0%   1%
Web Pages: Dynamic          327        0    0%   0.970 MB       0  B   0%   0%
Archives & Executables      245        0    0%  81.588 MB       0  B   0%   7%
Dev. Source Code             85        0    0%   8.762 MB       0  B   0%   1%
Text & RTF Files             46        6   13% 144.365 KB 129.427 KB  90%   0%
Streaming Audio/Video         9        0    0% 147.515 KB       0  B   0%   0%
==============================================================================

~~~ Objects Size Report ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------|------ R E Q U E S T S  -------|----------- T R A F F I C -----------
  SIZE   |  total | misses |  hits  |hit%|   total  |  misses  |   hits   |hit%
---------|--------|--------|--------|----|----------|----------|----------|----
  0-0.1KB     430      226      204   47%       0  B       0  B       0  B   0%
0.1-1.0KB  54.714K  20.573K  34.141K  62%  27.189 MB   9.072 MB  18.117 MB  67%
  1-5  KB  18.637K  11.087K   7.550K  41%  50.343 MB  31.163 MB  19.181 MB  38%
  5-10 KB  13.370K   9.752K   3.618K  27%  93.374 MB  68.478 MB  24.896 MB  27%
 10-50 KB  10.214K   6.870K   3.344K  33% 210.071 MB 134.421 MB  75.650 MB  36%
 50-100KB   1.297K     985      312   24%  85.473 MB  65.038 MB  20.435 MB  24%
100-500KB   1.426K   1.243K     183   13% 324.820 MB 289.907 MB  34.913 MB  11%
0.5-1.0MB     169      157       12    7% 110.864 MB 103.485 MB   7.379 MB   7%
  1-5  MB      73       67        6    8% 110.328 MB 101.409 MB   8.919 MB   8%
  5-10 MB       3        3        0    0%  20.097 MB  20.097 MB       0  B   0%
 10-50 MB       8        8        0    0% 161.113 MB 161.113 MB       0  B   0%
 50-100MB       0        0        0    0%       0  B       0  B       0  B   0%
   >100MB       0        0        0    0%       0  B       0  B       0  B   0%
===============================================================================

~~~ Squid Result Codes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

|      Result Code       | Requests  |  Traffic   |
|------------------------|-----------|------------|
             TCP_MEM_HIT    32.564K      43.443 MB
                 TCP_HIT    15.778K     165.678 MB
             TCP_IMS_HIT     1.028K     376.142 KB
             TOTAL HITS:    49.370K     209.489 MB

|------------------------|-----------|------------|
                TCP_MISS    50.198K       0.942 GB
 TCP_CLIENT_REFRESH_MISS       773       19.956 MB
==================================================
           TOTAL MISSES:    50.971K       0.961 GB

          TOTAL HITS VOLUME: 49.20 %       17.55 %

|------------------------|-----------|------------|
              TCP_DENIED     7.909K      31.212 MB
        TCP_REFRESH_FAIL        13      103.298 KB
    TCP_REFRESH_MODIFIED       646        6.380 MB
                    NONE       282        0.982 MB
  TCP_REFRESH_UNMODIFIED     3.169K      35.424 MB
==================================================

~~~ HTTP Status Codes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 ## | Description/Name        | Requests  |  Traffic   |  Group  |
----|-------------------------|-----------|------------|---------|
200  OK                           67.642K      0.951 GB  OK
302  Moved Temporarily            31.234K     16.551 MB  OTHER
403  Forbidden                     8.370K     31.779 MB  DENY
304  Not Modified                  1.511K    528.736 KB  OK
206  Parital Content                 794     240.992 MB  OK
404  Not Found                       781     821.731 KB  ERROR
503  Service Unavailable             509       1.049 MB  ERROR
000  UDP Traffic                     415           0  B  UDP
204  No Content                      364     103.737 KB  OTHER
400  Bad Request                     250     835.121 KB  ERROR
502  Bad Gateway                     216     818.659 KB  ERROR
301  Moved Permanently               184      82.934 KB  OTHER
411  Length Reqiured                  45     172.797 KB  ERROR
504  Gateway Timeout                  30     117.399 KB  TIMEOUT
500  Internal Server Error            10      52.160 KB  ERROR
303  See Other                         2       1.519 KB  OTHER
307  Temporary Redirect                1       1.057 KB  OK
505  HTTP Ver. Not Supported           1         644  B  ERROR
416  Request Range Not Satif.          1         375  B  ERROR
==============================|===========|============|========|
                      TOTALS:    112.360K      1.238 GB

 Group         | Requests     %Vol      |     Traffic     %Vol  |
---------------|------------------------|-----------------------|
OK                69.948K    62.25%            1.187 GB  95.87%
OTHER             31.784K    28.29%           16.735 MB   1.32%
DENY               8.370K     7.45%           31.779 MB   2.51%
ERROR              1.813K     1.61%            3.687 MB   0.29%
UDP                  415      0.37%                0  B   0.00%
TIMEOUT               30      0.03%          117.399 KB   0.01%
===============================================================

~~~ Request Methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------|------- R E Q U E S T S -----|-------- T R A F F I C ---------|
 Method        |  %VOL  | Requests |  denied |  %VOL  |  Traffic   |  denied  |
---------------|--------|----------|---------|--------|------------|----------|
GET              94.64%   106.339K    7.232K   99.44%     1.231 GB  28.916 MB
POST              5.12%     5.753K      665     0.50%     6.324 MB   2.292 MB
NONE              0.19%       216         0     0.06%   749.025 KB       0  B
HEAD              0.03%        32        12     0.00%    11.404 KB   4.148 KB
KU                0.01%        10         0     0.00%    37.790 KB       0  B
REPORT            0.01%         9         0     0.00%    30.773 KB       0  B
                 0.00%         1         0     0.00%     3.395 KB       0  B
==============================================================================

~~~ Protocols & Ports (Requests) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 Port | Protocol  | Total    %VOL | Misses Miss% |  Hits   Hit% |  Deny  Deny%|
------|-----------|---------------|--------------|--------------|-------------|
[ALL]  HTTP        108.250K100.00%   50.971K  47%   49.370K  46%   7.909K   7%
==================|===============|==============|==============|=============|
          TOTALS:  108.250K   100%   50.971K  47%   49.370K  46%   7.909K   7%

~~~ Protocols & Ports (Traffic) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 Port | Protocol  |   Total    %VOL | Misses   Miss%|  Hits    Hit% |  Deny
------|-----------|-----------------|---------------|---------------|----------
[ALL]  HTTP          1.196 GB 100.00%   0.961 GB  80% 209.489 MB  17%  31.212 MB
==================|=================|===============|===============|==========
          TOTALS:    1.196 GB   100%   0.961 GB  80% 209.489 MB  17%  31.212 MB

~~~ All Done. Enjoy Your Report.  /  SCALAR (C) 2004, http://scalar.risk.az ~~~

转载请注明:爱开源 » Squid高级日志分析

您必须 登录 才能发表评论!