LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-06-2011, 02:14 AM   #1
Norwegian
LQ Newbie
 
Registered: Apr 2009
Location: Norway, Europe
Distribution: Slackware
Posts: 13

Rep: Reputation: 0
Have Apache HTTP server resolve hostnames in logfile on Slackware.


Like this:

1.2.3.4 customer.43343.someisp.com
 
Old 10-06-2011, 03:27 AM   #2
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
Hi,

You mean you want to resolve the client's IP? You can do it, but it will slow down your webserver, because it has to contact a dns server to resolve those IPs
Anyway, there is logresolve provided by apache for this.
It's better to use it offline (may through a cronjob) like in the example given in the link above. If you want to resolve client IPs directly, yu need to change CustomLog, like this:
Code:
CustomLog "| /usr/sbin/logresolve >> /var/log/httpd/access_log.new" common
Regards
 
Old 10-07-2011, 12:24 AM   #3
Norwegian
LQ Newbie
 
Registered: Apr 2009
Location: Norway, Europe
Distribution: Slackware
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
Hi,

You mean you want to resolve the client's IP?
Yes.

Quote:
Originally Posted by bathory
Anyway, there is logresolve provided by apache for this.
What's wrong here:

Code:
root@slackware:/var/log/httpd# logresolve -s statistics -c access_log access_log.new
Usage: logresolve [-s statfile] [-c] < input > output
root@slackware:/var/log/httpd#
 
Old 10-07-2011, 12:45 AM   #4
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:
What's wrong here:

Code:

root@slackware:/var/log/httpd# logresolve -s statistics -c access_log access_log.new
Usage: logresolve [-s statfile] [-c] < input > output
root@slackware:/var/log/httpd#
Did you see the logresolve usage? You have to use redirections to the input and output files, like:
Code:
 logresolve -s statistics -c < access_log > access_log.new
Regards
 
Old 10-07-2011, 01:36 AM   #5
Norwegian
LQ Newbie
 
Registered: Apr 2009
Location: Norway, Europe
Distribution: Slackware
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks for helping me so far

However I get more error messages: (long list)

Bad host: lan-84-240-XX-XXX.vln.skynet.lt != 84.240.XX.XXX
Bad host: pppoeclXXXXXX.minlos.no != 82.116.XX.XX
 
Old 10-07-2011, 02:24 AM   #6
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
These are dns errors. After doing a reverse lookup for the client IP, logresolve does a forward lookup and finds that they are not the same, so it produces this "error"
You can stop this by omitting the -c switch in the command above.

Regards
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to resolve hostnames (DNS) from LAN pc's > server > internet KeenAs Linux - Networking 12 01-10-2009 08:17 AM
Resolve hostnames to IP veeruk101 Linux - Networking 2 04-14-2007 11:40 PM
Cannot resolve hostnames BobBuchanan Linux - Networking 1 02-12-2005 05:56 PM
Can't resolve hostnames....need help shaggystyle Linux - Networking 2 08-28-2004 02:20 AM
resolve hostnames zero_kewl Linux - General 5 09-01-2003 04:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:12 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