7

I am experiencing a problem with an init.d script (the service won't start), so I'm wondering if a log is available so I can fix the problem.

William
  • 584
  • 2
  • 9
  • 27

1 Answers1

6

What script writes to what log file, depends on the script. On CentOS 6.5 if I restart sshd then /var/log/secure.log is written to, and if I restart postfix that goes to /var/log/maillog.

The easiest way to find out (instead of wading through configuration files) is IMO just to try and restart the service, and then do:

ls -t --full-time /var/log | head -5 

And see if any of the top files was written to by this restart action by looking at its date info.


Just out of curiosity I looked to see why postfix writes to /var/log/maillog. That path is actually specified in /etc/rsyslog.conf and maps any mail-related syslog messages there. Searching for "maillog" in files under /etc/postfix/ gives no results, and neither does searching for mail there. Actually, via the syslog wiki page, you can find a number (2) that is used by syslog to log any mail-related messages.
So, a program doesn't have to have some path hard-coded or listed in a configuration file to be able to log under /var/log. Without knowledge of syslog and other possible logging facilities, the aforementioned method looks like a good first-try.

OmarOthman
  • 105
  • 3
Anthon
  • 78,313
  • 42
  • 165
  • 222