12.3.4 应用日志
除了系统日志以外,Linux系统中的应用软件也有自己的日志文件。由于不同的应用软件都会有特殊的日志格式,限于篇幅原因,在这里不能逐一进行介绍,一般情况下这些日志都会存放于软件安装目录下的logs目录下。作为系统管理员,应该清楚如何使用这些日志文件,以便在软件出现故障时能快速找到有效的信息支持。例如,下面是Apache软件错误日志的一个内容截取。
//警告信息,进程id文件/usr/local/apache2/logs/httpd.pid被覆盖,上一次关闭可能是非正常的
[Mon Aug 11 22:27:34 2008] [warn] pid file /usr/local/apache2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Mon Aug 11 22:27:34 2008] [notice] Apache/2.2.9 (Unix) configured -- resuming normal operations
//尝试执行目录/usr/local/apache2/cgi-bin/中的脚本
[Mon Aug 11 22:27:40 2008] [error] [client 127.0.0.1] attempt to invoke directory as script: /usr/local/apache2/cgi-bin/
[Mon Aug 11 22:27:40 2008] [error] [client 127.0.0.1] attempt to invoke directory as script: /usr/local/apache2/cgi-bin/
[Mon Aug 11 22:27:41 2008] [error] [client 127.0.0.1] attempt to invoke directory as script: /usr/local/apache2/cgi-bin/
[Mon Aug 11 22:27:41 2008] [error] [client 127.0.0.1] attempt to invoke directory as script: /usr/local/apache2/cgi-bin/
//接收到SIGHUP信号,准备重启Apache
[Mon Aug 11 22:29:12 2008] [notice] SIGHUP received. Attempting to restart
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Mon Aug 11 22:29:12 2008] [notice] Apache/2.2.9 (Unix) configured -- resuming normal operations
[Mon Aug 11 22:29:14 2008] [error] [client 127.0.0.1] attempt to invoke directory as script: /usr/local/apache2/cgi-bin/
// 找不到文件/usr/local/apache2/htdocs/cgi-bin
[Mon Aug 11 22:29:40 2008] [error] [client 127.0.0.1] File does not exist: /usr/local/apache2/htdocs/cgi-bin
[Mon Aug 11 22:29:43 2008] [error] [client 127.0.0.1] File does not exist: /usr/local/apache2/htdocs/favicon.ico
[Mon Aug 11 22:30:01 2008] [error] [client 127.0.0.1] attempt to invoke directory as script: /usr/local/apache2/cgi-bin/
关于Apache日志更多的说明,请参考16.3.6节的内容。