Obtaining list of startup times from apache log files

  • 7000029
  • 08-Apr-2008
  • 03-Jul-2012

Environment

Apache 2.x on NetWare or Linux

Situation

This document will illustrate a simple Linux command that can be used to obtain a list of startup and shutdown times for the Apache web server 2.x .

Resolution

First, identify the log file to be searched. If the log files are located on the web server, they may be copied over to a Linux workstation or server (specifically for the grep command). The default locations are :

NetWare :
SYS:/Apache2/logs/error_log.########  (find the latest log file)
Linux :
/var/log/apache2/error_log

With the log file copied to the linux workstation, assuming that the file is called error_log, run the command :

grep -E "caught SIGTERM|resuming normal operations" error_log

This will print the startup time entries, and the shutdown time entries, as found in the log file :

[Fri Dec 07 14:57:28 2007] [notice] Apache/2.2.3 (Linux/SUSE) configured -- resuming normal operations
[Mon Dec 10 07:19:48 2007] [notice] caught SIGTERM, shutting down
[Mon Dec 10 07:19:51 2007] [notice] Apache/2.2.3 (Linux/SUSE) configured -- resuming normal operations
[Mon Dec 10 07:25:54 2007] [notice] caught SIGTERM, shutting down
[Mon Dec 10 07:25:58 2007] [notice] Apache/2.2.3 (Linux/SUSE) configured -- resuming normal operations
[Tue Dec 11 08:34:22 2007] [notice] caught SIGTERM, shutting down
[Tue Dec 11 14:29:01 2007] [notice] Apache/2.2.3 (Linux/SUSE) configured -- resuming normal operations
[Thu Dec 13 14:38:10 2007] [notice] caught SIGTERM, shutting down