Tuesday, 17 December 2013

Update access log for Squid Server with Date and Time on Linux

Some time user monitoring is very difficult on Squid Server, And it is very difficult to trace which types of website is access by user with date and time. We can solve this issue with the following configuration on Linux Server.

Open your squid.conf and search for the line that starts with access_log or cache_access_log and looks like:


#vi /etc/squid/squid.conf


and search for the line that starts with access_log or cache_access_log


access_log /var/log/squid/access.log squid


Please note that the path to the log file may vary in your case.


Note that last keyword (in this case squid, but it could be common, combined). Then look for the line that starts with logformat squid and change "%ts.%03tu" with "%tl" for local time or "%tg" for GMT time.

Please note that  if the line does not exist you should add it. 

For the above example it should changed from:


logformat squid  %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt


To:


logformat squid  %tl. %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt


Now do restart Squid Server and see access file again:


#service squid restart


#vi /var/log/squid/access.log


For any query please feel free to contact me my Email ID is sashwatkatore@gmail.com.

No comments:

Post a Comment