LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 05-08-2014, 06:25 AM   #1
danialnaeem
Member
 
Registered: Feb 2014
Posts: 35

Rep: Reputation: Disabled
Question 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
 
Old 05-08-2014, 06:35 AM   #2
Enindu
Member
 
Registered: Apr 2014
Location: Colombo, Sri Lanka
Distribution: Arch Linux
Posts: 69

Rep: Reputation: 13
Can't open access.log in Geany as root?
 
Old 05-08-2014, 06:39 AM   #3
danialnaeem
Member
 
Registered: Feb 2014
Posts: 35

Original Poster
Rep: Reputation: Disabled
i can see logs in access.log file but i want to see it in good format in excel. is it possible ?
 
Old 05-08-2014, 07:32 AM   #4
Enindu
Member
 
Registered: Apr 2014
Location: Colombo, Sri Lanka
Distribution: Arch Linux
Posts: 69

Rep: Reputation: 13
No idea. Sorry.
 
Old 05-08-2014, 08:15 AM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by danialnaeem View Post
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
 
Old 05-14-2014, 12:27 AM   #6
danialnaeem
Member
 
Registered: Feb 2014
Posts: 35

Original Poster
Rep: Reputation: Disabled
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
 
Old 05-14-2014, 02:01 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by danialnaeem View Post
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.
Old 05-14-2014, 05:53 AM   #8
eklavya
Member
 
Registered: Mar 2013
Posts: 636

Rep: Reputation: 142Reputation: 142
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.
Old 05-15-2014, 12:25 AM   #9
danialnaeem
Member
 
Registered: Feb 2014
Posts: 35

Original Poster
Rep: Reputation: Disabled
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
 
Old 05-15-2014, 01:46 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by danialnaeem View Post
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
 
Old 05-15-2014, 03:07 AM   #11
danialnaeem
Member
 
Registered: Feb 2014
Posts: 35

Original Poster
Rep: Reputation: Disabled
ok thank you so much ....

and if i need this denied logs with specific IP address?? then how i can see this?


Thanks
 
Old 05-15-2014, 03:38 AM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by danialnaeem View Post
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
 
Old 05-16-2014, 01:11 AM   #13
danialnaeem
Member
 
Registered: Feb 2014
Posts: 35

Original Poster
Rep: Reputation: Disabled
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 01:19 AM.
 
Old 05-16-2014, 02:16 AM   #14
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by danialnaeem View Post
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.
 
Old 05-16-2014, 02:36 AM   #15
danialnaeem
Member
 
Registered: Feb 2014
Posts: 35

Original Poster
Rep: Reputation: Disabled
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 02:37 AM.
 
  


Reply

Tags
squid



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Re-Organize Squid access log file.... harshaabba Linux - Software 1 10-07-2011 04:41 AM
Squid access log file agar_000 Linux - Newbie 1 09-01-2011 05:10 AM
Deleted access.log file from squid evocage Red Hat 3 08-24-2011 03:18 AM
In Apache server, How to change log file location and log format for access log fil? since1993 Linux - Server 1 08-19-2009 04:14 PM
Squid logging access.log file revinking Linux - Newbie 1 07-28-2008 05:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration