The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Temporary log format change

Discussion in 'EasyApache' started by Rakaris Bakaris, Oct 6, 2016.

  1. Rakaris Bakaris

    Joined:
    Jan 8, 2015
    Messages:
    22
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    Hello!
    I need to change for temporary period log format for single domain with subdomains. I have seen that on httpd.conf there are lines for domain and subdomains.
    Code:
    CustomLog /usr/local/apache/domlogs/api.dev.domain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    When opening the api.dev.domain.com-bytes_log I have found that this is not right access log for me because of it's format.
    Regarding this I have the following questions:
    1) If I add additional CustomLog directive will it write addtitional log if I run /usr/local/cpanel/bin/apache_conf_distiller --update
    2) Are there something bad can happen if I add the log format for single domain including subdomains?
    3) I need to add milliseconds for log format. Will it work if I add to log line msec_frac?

    Code:
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %{CF-Connecting-IP}i -%{msec_frac}t" combined
    Thank you!
     
    #1 Rakaris Bakaris, Oct 6, 2016
    Last edited: Oct 6, 2016
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    You can make the change for a single VirtualHost using the instructions at:

    Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation

    Or, if you are using EasyApache 3:

    Advanced Apache Configuration - EasyApache - cPanel Documentation

    An error will occur if there's invalid syntax when running "/scripts/rebuildhttpdconf". Information on custom Log format configuration is available at:

    mod_log_config - Apache HTTP Server Version 2.4

    Let us know if this helps.

    Thank you.
     
  3. Rakaris Bakaris

    Joined:
    Jan 8, 2015
    Messages:
    22
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    Hello!
    Cpanel / Apache ignores custom log format. I have created a file on:
    /usr/local/apache/conf/userdata/std/2_4/domain/domain.com/domain.com.conf
    which contains the folowing lines:
    Code:
    LogFormat "%V %a %l %u %{%d/%b/%Y %T}t.%{msec_frac}t %{%z}t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
    CustomLog  /usr/local/apache/domlogs/domain.com.log combined
    also this one
    Code:
    LogFormat "%{%d/%b/%Y %T}t.%{msec_frac}t %{%z}t" combined
    CustomLog  /usr/local/apache/domlogs/domain.com.log combined
    After each modification I have made "/scripts/rebuildhttpdconf" and "/scripts/restartsrv_httpd" without errors.
    After that the custom log is generated on specified location, but the log format is not changed. Why custom format is ignored?
     
  4. Rakaris Bakaris

    Joined:
    Jan 8, 2015
    Messages:
    22
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    I have made the following changes to file
    And this worked for me.
    Thanks!
     
    cPanelMichael likes this.
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page