LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   HTTP Config + point error log to syslogd (http://www.linuxquestions.org/questions/linux-newbie-8/http-config-point-error-log-to-syslogd-890774/)

masterav 07-09-2011 08:41 AM

HTTP Config + point error log to syslogd
 
Hi,
I have configured a virtual host.Here is what i have did,

<VirtualHost rubby.tob.net:80>
ServerAdmin root@localhost
DocumentRoot /var/www/html/
ServerName rubby.tob.net
# ErrorLog logs/dixie_error_log
ErrorLog syslog | local8.*
CustomLog logs/rubby_access_log common
</VirtualHost>
<VirtualHost tubby.tob.net:80>
ServerAdmin root@localhost
DocumentRoot /var/www/html/
ServerName tubby.tob.net
# ErrorLog logs/glpi_error_log
ErrorLog syslog | local9.*
CustomLog logs/tubby_access_log common
</VirtualHost>


The problem here is how to point the error log to syslogd.Here is my syslog file,

#vim /etc/syslog.conf


og all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages

# The authpriv file has restricted access.
authpriv.* /var/log/secure

# Log all the mail messages in one place.
mail.* -/var/log/maillog


# Log cron stuff
cron.* /var/log/cron

# Everybody gets emergency messages
*.emerg *

# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler

# Save boot messages also to boot.log
local7.* /var/log/boot.log

local8.* /var/log/httpd/rubby_error_log
local9.* /var/log/httpd/tubby_error_log
~
~

If i point the file,separatelt at httpd.conf for the errorlog,i'm getting the errog log.I'm using Centos 5.6.

Thanks in advance.
~
.

bathory 07-09-2011 09:27 AM

Hi,

First of all there are 8 local facilities (local0 to local7) in syslog.conf.
Second in apache ErrorLog directive you need a colon ":" and not the pipe symbol "|" to define the syslog facility. And you dont need a "*" at the end
So use:
Code:

ErrorLog syslog:local0
and in syslog.conf, add:
Code:

local0.*                                        /var/log/httpd/rubby_error_log
Regards

masterav 07-10-2011 12:31 AM

Hi Bathory,

Thanks for your reply,and i have tried as you have pointed out but still I couldn't find any error logs getting updated in the respective log files.When I point out directly to the error files at httpd.conf,it working perfectly,while using syslog it is not working.


Yes i have found the mistake, just a typo.....But still there is another problem ,I've two virtual host(Please see at the top for the httpd config file),I'm getting error logs onlt for first virtual host,that is rubby.gai.net and not for tubby.gai.net


Finalised the problem:

I found that only for the entry where there is local0 in syslog is taking.Whereas the local1 which is pointed for another virtual host is not taking.let me show,

#vim /etc/syslog.conf



# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages

# The authpriv file has restricted access.
authpriv.* /var/log/secure

# Log all the mail messages in one place.
mail.* -/var/log/maillog


# Log cron stuff
cron.* /var/log/cron

# Everybody gets emergency messages
*.emerg *

# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler

# Save boot messages also to boot.log
local7.* /var/log/boot.log

local1.* /var/log/httpd/rubby_error_log
local0.* /var/log/httpd/tubby_error_log





And my httpd.conf


<VirtualHost rubby.tob.net:80>
ServerAdmin root@localhost
DocumentRoot /var/www/html/
ServerName rubby.tob.net
# ErrorLog logs/dixie_error_log
ErrorLog syslog:local1
CustomLog logs/rubby_access_log common
</VirtualHost>
<VirtualHost tubby.tob.net:80>
ServerAdmin root@localhost
DocumentRoot /var/www/html/
ServerName tubby.tob.net
# ErrorLog logs/glpi_error_log
ErrorLog syslog:local0
CustomLog logs/tubby_access_log common
</VirtualHost>

Here is the case, i'm getting errors only for tubby.gai.net, and it going to the rubby_error_logs file.I'm not getting it for rubby.tob.net

bathory 07-10-2011 03:59 AM

Hi,

You can change the ErrorLog for rubby.tob.net to
Code:

ErrorLog "|/usr/bin/logger -p local1.info"
so it logs to /var/log/httpd/rubby_error_log through the local1 facility

Regards

masterav 07-10-2011 05:43 AM

Quote:

Originally Posted by bathory (Post 4410440)
Hi,

You can change the ErrorLog for rubby.tob.net to
Code:

ErrorLog "|/usr/bin/logger -p local1.info"
so it logs to /var/log/httpd/rubby_error_log through the local1 facility

Regards


Hi Bathory,

That done the trick,

Thanks a lot :-)


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