LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache "access_log" not created. "CustomLog" not working (https://www.linuxquestions.org/questions/linux-server-73/apache-access_log-not-created-customlog-not-working-905574/)

senthilvael 09-29-2011 05:15 AM

Apache "access_log" not created. "CustomLog" not working
 
Hi Team,
Recently I compiled Apache/2.2.21 from source. Everything working great except the access log not created at any where. But Error log is created and appended properly. I can see the following in my httpd.conf

Code:

ErrorLog "logs/error_log"
LogLevel warn

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access_log" common
</IfModule>

I checked if log_config_module is loaded. Its loaded properly. Please see the following op.

Code:

[root@server conf]# /apache/bin/apachectl -t -D DUMP_MODULES
Loaded Modules:
 core_module (static)
 mpm_worker_module (static)
 http_module (static)
 so_module (static)
 sm_module (shared)
 authz_host_module (shared)
 proxy_module (shared)
 proxy_connect_module (shared)
 proxy_http_module (shared)
 include_module (shared)
 deflate_module (shared)
 log_config_module (shared)
 expires_module (shared)
 headers_module (shared)
 setenvif_module (shared)
 mime_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 speling_module (shared)
 alias_module (shared)
 rewrite_module (shared)
 jk_module (shared)
Syntax OK

But access_log file is not created in the log dir. The error log is working properly.

I tried to use CustomLog directive inside virtual host block as follows.

Code:

CustomLog "| /apache/bin/rotatelogs /apache/logs/mysitecom.%Y%m%d.access.log 86400" combined
The mysite.com access log is created but it contains only one word "combined" is there.

Any help or suggestion will be appreciated.

snooly 09-29-2011 06:35 AM

Have you tried accessing the web server? I expect you would have, but I guess we have to check.

lithos 09-29-2011 06:49 AM

the Log command under <VirtualHost ...>
Code:

ErrorLog /var/log/httpd/error_log
CustomLog /var/www/html/sitedomain_dirname/example.com_access_log combined

the format in "httpd.conf" file:

Code:

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog /var/log/httpd/error_log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn


#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%m %{Host}i%U%q %H\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here.  Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog /var/log/httpd/access_log common

the files could not be there, so you can create them with : "touch /var/log/httpd/access_log" etc.
give them if needed "chmod 644 ..."


All times are GMT -5. The time now is 02:07 AM.