Log Format Time Stamp in Squid 2.7 Stable9
20 12 2011Usually access.log in squid will show like below ;
1324356848.722 4 10.1.1.26 TCP_DENIED/403 1369 GET http://www.youtube.com/apiplayer? - NONE/- text/html
1324356848.771 1 10.1.1.26 TCP_DENIED/403 1369 GET http://www.youtube.com/apiplayer? - NONE/- text/html
1324356848.828 3 10.1.1.26 TCP_DENIED/403 1369 GET http://www.youtube.com/apiplayer? - NONE/- text/html
My boss Ask me to set time more human readable for squid access.log
After read and looking round in Google finally we can set format access.log using below code (add in file squid.conf);
logformat squid %tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
Default squid has logformat below ;
logformat squid %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
logformat squidmime %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt [%>h] [%<h]
logformat common %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st %Ss:%Sh
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
So i change part %ts.%03tu to %tl, then output of log will show like this ;
20/Dec/2011:13:52:21 +0900 1794 10.1.1.26 TCP_MISS/200 5269 GET http://ad.yieldmanager.com/st? - DIRECT/202.43.205.15 -
20/Dec/2011:13:52:21 +0900 1906 10.1.1.26 TCP_MISS/200 585 GET http://us.bc.yahoo.com/b? - DIRECT/203.84.204.124 image/gif
Categories : Linux
Beberapa hari ini bos meminta untuk dibuatkan proxy server, seleumnya sudah ada proxy server dan gateway dalam satu mesin. Namun, belakangan ini sering down. Sebagai alternative untuk mengurangi beban kerja server, di usulkan gateway dan proxy di pindah ke mesin lain.





