Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
05-08-2014, 07:25 AM
|
#1
|
Member
Registered: Feb 2014
Posts: 35
Rep:
|
how to export squid access.log file in readable format?
Dear Experts?
Please tell me how to export squid access.log file in readable and good format.
Regards
Danial
|
|
|
05-08-2014, 07:35 AM
|
#2
|
Member
Registered: Apr 2014
Location: Colombo, Sri Lanka
Distribution: Arch Linux
Posts: 69
Rep:
|
Can't open access.log in Geany as root?
|
|
|
05-08-2014, 07:39 AM
|
#3
|
Member
Registered: Feb 2014
Posts: 35
Original Poster
Rep:
|
i can see logs in access.log file but i want to see it in good format in excel. is it possible ?
|
|
|
05-08-2014, 08:32 AM
|
#4
|
Member
Registered: Apr 2014
Location: Colombo, Sri Lanka
Distribution: Arch Linux
Posts: 69
Rep:
|
No idea. Sorry.
|
|
|
05-08-2014, 09:15 AM
|
#5
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,214
|
Quote:
Originally Posted by danialnaeem
i can see logs in access.log file but i want to see it in good format in excel. is it possible ?
|
You can change the access_log format from "squid" to "common" in squid.conf. E.g:
Code:
access_log /var/log/squid/access.log common
|
|
|
05-14-2014, 01:27 AM
|
#6
|
Member
Registered: Feb 2014
Posts: 35
Original Poster
Rep:
|
this line is not showing in my squid conf file.. when i open logs file in excel all data are showing in first column... i want to convert access log data in good and proper excel format please help
|
|
|
05-14-2014, 03:01 AM
|
#7
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,214
|
Quote:
Originally Posted by danialnaeem
this line is not showing in my squid conf file.. when i open logs file in excel all data are showing in first column... i want to convert access log data in good and proper excel format please help
|
You can copy and rename the squid access.log to squid.csv for example. Then you can import the csv file into excel by specifying as separator the "space".
Please note that instead of using excel, you can use sarg to generate reports based on squid logs.
Regards
|
|
1 members found this post helpful.
|
05-14-2014, 06:53 AM
|
#8
|
Member
Registered: Mar 2013
Posts: 636
Rep:
|
Quote:
# sed 's/ */,/g' /var/log/squid/access.log > /var/log/squid/access.csv
|
It will replace every space into comma.
Now open this csv file into spread sheet. Check comma check box under 'separated by' option.
|
|
1 members found this post helpful.
|
05-15-2014, 01:25 AM
|
#9
|
Member
Registered: Feb 2014
Posts: 35
Original Poster
Rep:
|
OK thank you .. very help full
i want to know one more thing can i see only TCP denied logs in squid access log report? any command ?
Thanks
|
|
|
05-15-2014, 02:46 AM
|
#10
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,214
|
Quote:
Originally Posted by danialnaeem
OK thank you .. very help full
i want to know one more thing can i see only TCP denied logs in squid access log report? any command ?
Thanks
|
You can grep for "DENIED" in squid access.log and redirect the output to a new file for processing:
Code:
grep DENIED /var/log/squid/access.log > squid_denied.log
|
|
|
05-15-2014, 04:07 AM
|
#11
|
Member
Registered: Feb 2014
Posts: 35
Original Poster
Rep:
|
ok thank you so much ....
and if i need this denied logs with specific IP address?? then how i can see this?
Thanks
|
|
|
05-15-2014, 04:38 AM
|
#12
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,214
|
Quote:
Originally Posted by danialnaeem
ok thank you so much ....
and if i need this denied logs with specific IP address?? then how i can see this?
Thanks
|
Use this:
Code:
cat /var/log/squid/access.log |grep DENIED| grep x.x.x.x > squid_denied_ip.log
where x.x.x.x is the IP in question
|
|
|
05-16-2014, 02:11 AM
|
#13
|
Member
Registered: Feb 2014
Posts: 35
Original Poster
Rep:
|
thank you very very much for you help bathory ... these two commands are very help full for me.. Sir can i generate these logs only TCP denied and with specific ip in readable date & time ???
Thanks
Last edited by danialnaeem; 05-16-2014 at 02:19 AM.
|
|
|
05-16-2014, 03:16 AM
|
#14
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,214
|
Quote:
Originally Posted by danialnaeem
thank you very very much for you help bathory ... these two commands are very help full for me.. Sir can i generate these logs only TCP denied and with specific ip in readable date & time ???
Thanks
|
Please have a look at post #5 to see the change you need to do in access_log format in order to display date in human readable format.
|
|
|
05-16-2014, 03:36 AM
|
#15
|
Member
Registered: Feb 2014
Posts: 35
Original Poster
Rep:
|
Sir, I am using squid 3.1 and this line is not showing in my squid.conf file. when i add this line in squid.conf file and restart service nothing happenes. ???
access_log /var/log/squid/access.log common
Last edited by danialnaeem; 05-16-2014 at 03:37 AM.
|
|
|
All times are GMT -5. The time now is 07:13 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|