How To customize the log file format of Apache webserver - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How To customize the log file format of Apache webserver

swap1234swap1234 Posts: 2Member
Hello,

I want to change default Log file format of the Apache server.
I know the command for it.It is as below..
[color=Red]LogFormat "%t %h %u %m %U %s %b %H %{Referer}i" "%{User-Agent}i" detailedLog[/color]
[color=Red]CustomLog logs/access.log detailedLog[/color]
But I don't know where to run this command.
Can anybody please help in this context?.
Tell me the steps

Regards,
Swap1234

Comments

  • zibadianzibadian Posts: 6,349Member
    : Hello,
    :
    : I want to change default Log file format of the Apache server.
    : I know the command for it.It is as below..
    : [color=Red]LogFormat "%t %h %u %m %U %s %b %H %{Referer}i"
    : "%{User-Agent}i" detailedLog[/color]
    : [color=Red]CustomLog logs/access.log detailedLog[/color]
    : But I don't know where to run this command.
    : Can anybody please help in this context?.
    : Tell me the steps
    :
    : Regards,
    : Swap1234
    :
    The log configuration can be set in the server configuration or the virtual host configuration.

    source: http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#customlog
  • swap1234swap1234 Posts: 2Member
    : : Hello,
    : :
    : : I want to change default Log file format of the Apache server.
    : : I know the command for it.It is as below..
    : : [color=Red]LogFormat "%t %h %u %m %U %s %b %H %{Referer}i"
    : : "%{User-Agent}i" detailedLog[/color]
    : : [color=Red]CustomLog logs/access.log detailedLog[/color]
    : : But I don't know where to run this command.
    : : Can anybody please help in this context?.
    : : Tell me the steps
    : :
    : : Regards,
    : : Swap1234
    : :
    : The log configuration can be set in the server configuration or the
    : virtual host configuration.
    :
    : source:
    : http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#customlog

    Thank u
    But I m not able to understand...
    can u please provide me detailed solution step-by-step.....

    Regards,
    Swap1234

  • zibadianzibadian Posts: 6,349Member
    : : : Hello,
    : : :
    : : : I want to change default Log file format of the Apache server.
    : : : I know the command for it.It is as below..
    : : : [color=Red]LogFormat "%t %h %u %m %U %s %b %H %{Referer}i"
    : : : "%{User-Agent}i" detailedLog[/color]
    : : : [color=Red]CustomLog logs/access.log detailedLog[/color]
    : : : But I don't know where to run this command.
    : : : Can anybody please help in this context?.
    : : : Tell me the steps
    : : :
    : : : Regards,
    : : : Swap1234
    : : :
    : : The log configuration can be set in the server configuration or the
    : : virtual host configuration.
    : :
    : : source:
    : : http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#customlog
    :
    : Thank u
    : But I m not able to understand...
    : can u please provide me detailed solution step-by-step.....
    :
    : Regards,
    : Swap1234
    :
    :
    If you want the custom log to be applied to the entire server then you need to place the LogFormat in your httpd.conf outside of any virtual host definitions.
    If you want the custom log to be applied to only one virtual host then you need to place the LogFormat in your httpd.conf inside of the virtual host definition, for which you need that format.
    If you want the custom log to be applied to more than one virtual hosts, then you need to place the LogFormat in your httpd.conf inside each of the of the virtual host definition, for which you need that format.
    The httpd.conf file is a plain text file in the conf folder, which is located in the installation folder of your apache server.
Sign In or Register to comment.