12 Feb 2010, 7:01 p.m.

Adding Reverse DNS Support to Webalizer

I recently had to reinstall Webalizer from source, after some conflicts necessitated removing the existing Yum-installed version. I ran into some problems in that the new installation of Webalizer wasn't performing reverse DNS lookups on visitor IP addresses - something it's usually happy to do. Searching the web was strangely fruitless, even though it seems to be a reasonably common issue, so here's a quick writeup of the problem and what I did to fix it.

The symptoms were that in statistics reports for all new visits, IP addresses were no longer being resolved to hostnames, and their country of origin was consistently "Unresolved/Unknown". I assume the latter problem was a result of the former.

Running the Webalizer process by hand revealed a couple of warnings, along with the process returning in a suspiciously brief amount of time:

Warning: Invalid keyword 'DNSCache' (/path/to/example.org.conf)
Warning: Invalid keyword 'DNSChildren' (/path/to/example.org.conf)

That's odd, those keywords have always been in the configs, has Webalizer deprecated them? The internet said no. The internet also said that the solution was to enable DNS lookups in Apache HTTPD, so that the IPs are already resolved by the time they reach the access logs, but that clearly isn't an option, for performance reasons.

Retracing the install process, I spotted the following output from configure:

configure: WARNING: libdb not found.. DNS/GeoDB code disabled!

Argh. That's confirmed by the Webalizer INSTALL file:

DNS lookup and native geolocation features are added if the required library (libdb) and header file (db.h) are found

That seems fairly clear then, though the server definitely has libdb installed:

[root@vps03 cron.hourly]$ locate libdb /lib/libdb-4.5.so /lib/libdb-4.7.so /lib/libdb_cxx-4.5.so /usr/lib/libdb-4.7.so

So that means sourcing a correctly-versioned copy of db.h. That turns out not to be as easy as it might seem, but some creative searching led to a blog post in Japanese, which in turn points to the db4-devel package available, thankfully, via Yum.

[root@vps03 cron.hourly]$ yum install db4-devel

Once that's installed, configure runs a lot more smoothly:

checking for main in -ldb... yes
checking db.h usability... yes
checking db.h presence... yes
checking for db.h... yes

Having rerun make and make install, triggering the Webalizer cron script by hand takes a reassuringly long time, and seems to fill in some of the gaps in the Webalizer reports. There are still unresolved IPs in there, no doubt legacy from previous runs, but I think that's taken care of things for now.

Lessons learned? I'd probably stick with the pre-packaged versions of Webalizer whenever possible.

Posted by Simon at 01:53:00 PM
19 Jun 2010, 12:25 a.m.

Thomas Heiss

Hi,

thanks for your tip. Was running into the same problem this evening.

I resolved it with this on Debian Lenny (5.0.2):
apt-get install libdb-dev

1 Dec 2013, 11:21 p.m.

Erik

Thank you, this helped me!