Linux Commands Examples

A great documentation place for Linux commands

logresolve

Resolve IP-addresses to hostnames in Apache log files

Synopsis

logresolve [ -s filename ] [ -c ] < access_log > access_log.new


add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!

examples

0
source
            
rlog=/home/ren/yufeiren.com/access.log
tlog=$rlog.tmp
logresolve < $alog > $tlog
# exclude access from hpdtl.cewit.stonybrook.edu
tac $tlog | sed '/hpdtl.cewit.stonybrook.edu/d' > $rlog
0
source
            
zcat "${LOG}" | logresolve | gzip > "${RESOLVED_LOG}"
# root owns log directory, canâ??t move files out
cp -p -- "${LOG}" "${NEWLOG}"
done

options

-s filename

Specifies a filename to record statistics.

-c

This causes logresolve to apply some DNS checks: after finding the hostname from the IP address, it looks up the IP addresses for the hostname and checks that one of these matches the original address.

summary

logresolve is a post-processing program to resolve IP-addresses in Apache’s access logfiles. To minimize impact on your nameserver, logresolve has its very own internal hash-table cache. This means that each IP number will only be looked up the first time it is found in the log file.

Takes an Apache log file on standard input. The IP addresses must be the first thing on each line and must be separated from the remainder of the line by a space.

How can this site be more helpful to YOU ?


give  feedback