3

Can someone please assist me.

I am trying to find a log on an Ubuntu server that will show me a history of dates and times when Apache was restarted.

Ubuntu version: Ubuntu 10.04.3 LTS Apache version: 2.2.14 (Ubuntu)

Thanks - Mike

MikeSNP
  • 103
  • 1
  • 2
  • 4

3 Answers3

6

apache usually logs to /var/log/apache2 - depending on what log rotation/cleaning you have going on there should at least be an access_log and an error_log (names may change depending on apache config). In each you should be able to see restart messages.

FreudianSlip
  • 2,870
  • 25
  • 24
  • Thanks for the reply. I had looked at all logs in /var/log/apache2 and did not see anything that recorded start or start of the web server. – MikeSNP Feb 13 '12 at 23:18
  • I get this recorded in my error.log : [Mon Feb 13 23:31:11 2012] [notice] caught SIGTERM, shutting down [Mon Feb 13 23:31:18 2012] [notice] Apache/2.2.20 (Ubuntu) PHP/5.3.6-13ubuntu3.5 with Suhosin-Patch configured -- resuming normal operations – FreudianSlip Feb 13 '12 at 23:31
  • Thanks for pointing this out. I found lines you refer to as well as [Thu Feb 09 16:10:14 2012] [notice] Graceful restart requested, doing restart – MikeSNP Feb 14 '12 at 13:55
  • The "AH00171: Graceful restart requested, doing restart" message indicates a `service apache2 reload`, while a `service apache2 restart` will lead to something like "AH00169: caught SIGTERM, shutting down". Both have in common that the log sequence ends with "AH00163 [...] resuming normal operations" so I suggest it's best to look out for that in most cases. – tanius Apr 15 '14 at 21:34
  • 2
    A shorter way of checking for what @tanius mentioned can be read here http://stackoverflow.com/a/15905798/295260 – johnsampson Feb 26 '15 at 19:17
  • 1
    found in error.log, its not an error so not sure why its there, not access.log for raspian anyway `cat /var/log/apache2/error.log | grep "shut"` – tsukimi Jan 11 '18 at 02:10
0

You could search for configured keyword in apache error logs:

### for centos/redhat:
egrep -irn 'configured' '/var/log/httpd/error_log'

### for ubunto:
egrep -irn 'configured' '/var/log/apache2/error_log'
Mojtaba Rezaeian
  • 8,268
  • 8
  • 31
  • 54
0

When we start or restart the apache, we get the logs in /var/log/apache2/error_logs with the word caught SIGTERM, shutting down

So we can find the error_logs with word SIGTERM, will get if apache service start|restart

Ninja Man
  • 86
  • 3