大网数据广告活动
服务器运维问答

Add timestamp to apache error log

· 52CE 我爱测

So I keep getting the following error in apache logs: sendmail: fatal: open /etc/postfix/main.cf: No such file or directory And I'm trying to figure out where/when it's being attempted, but I can't figure out where in the apache …

问题原文

原帖链接 · Aram Papazian · CC BY-SA 3.0

So I keep getting the following error in apache logs:

sendmail: fatal: open /etc/postfix/main.cf: No such file or directory

And I'm trying to figure out where/when it's being attempted, but I can't figure out where in the apache logs I'm supposed to change the conf in order to get this to show more information. Any ideas?

I have the following in my apache2.conf (which I assumed would make it dislay the proper formatting):

ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

Note, I don't want to fix the error itself (aka make it so that the file exists, fix postfix etc.) I just want to know what is trying to execute the sendmail command.

已采纳解答

原帖链接 · Dom · CC BY-SA 3.0

Your apache try to send email. Maybe from PHP or CGI scripts, but not by itself. If the script is chrooted, it can not access to /etc/postfix/main.cf and return the error. You will not see anything in the logs (except on small sites where you will be able to found the URL asked by the user at the same time that the error line).

You can maybe add a custom log (with %{format}t option)[1], but you will not have it in error log.

Edit : You can also redirect the Error log to Syslog to have the date added by syslog : ErrorLog syslog:local1

[1] https://httpd.apache.org/docs/trunk/mod/mod_log_config.html#formats

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。