4.2.5 Converting the IP address of log file into a host name (logresolve command)
The logresolve command converts the IP address of the access log file (that has IP address at the beginning of the record) into the host, and outputs to the new log file. The conversion rule depends on the reverse lookup of host name.
- Organization of this subsection
(1) Format
logresolve [-s file-name] [-c] Access-log-file-name New-log-file-name
(2) Parameters
-
-s file-name
This parameter specifies the output file name that contains the converted IP address. The following information is output to this file:
-
Number of host names
-
Number of different IP addresses
-
Number of IP addresses that could not be converted
-
-
-c
Use this option to check whether the host name after conversion matches the IP address before conversion.
-
Access-log-file-name
This parameter specifies the input log file name. Reverse the look up of the host name from the IP address mentioned in the input file. The IP address must be at the top of the record. If an attempt to retrieve the host name fails, the IP address is output to the new log file.
-
New-log-file-name
This parameter specifies a file name that outputs the access log with IP address converted to the host.
(3) How to use
Convert the IP address of access log stored in the logs\access.log, into the host name.
Access log file: logs\access.log
New log file: logs\new_access.log
logresolve < logs\access.log > logs\new_access.log