apache HostnameLookups in LogFormat

  • HostnameLookups Off did not effect for the logfiles

    what do you think ... can or should it removed or is this parameter %h needed in imscp or fail2ban etc?

    1. LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
    2. LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
    3. LogFormat "%h %l %u %t \"%r\" %>s %O" common
  • Hello ;

    First of all, the logFormat directives that you mention don't match with those provided by i-MSCP which are:


    1. LogFormat "%v %I %O %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vlogs

    As you can see there, only one logFormat directive is provided and is different than the one you posted ( which are de facto not compatible with i-MSCP ).

    For your question

    As far as I know, the answer from the link you mention is false. If you look at your access.log files, you will see that the first entry, which correspond to the %h format string, is always an IP address and not an hostname. So here, the HostnameLookups Off does its job as expected:


    1. #
    2. # HostnameLookups: Log the names of clients or just their IP addresses
    3. # e.g., www.apache.org (on) or (off).
    4. # The default is off because it'd be overall better for the net if people
    5. # had to knowingly turn this feature on, since enabling it means that
    6. # each client request will result in AT LEAST one lookup request to the
    7. # nameserver.
    8. #
    9. HostnameLookups Off

    Of course, you could replace the %h format string by the %a format string but I doubt that will change anything. This should not pose any problem with fail2ban nor with AWStats.