Question

When I run brew services list one of my services state shows err. brew services restart elasticsearch@6 for example stops and restarts with no error output and shows:

brew services restart elasticsearch@6
Stopping `elasticsearch@6`... (might take a while)
==> Successfully stopped `elasticsearch@6` (label: homebrew.mxcl.elasticsearch@6)
==> Successfully started `elasticsearch@6` (label: homebrew.mxcl.elasticsearch@6)

But list still shows err. There's something wrong but Homebrew doesn't tell us what it is. How to fix this problem?

Was it helpful?

Solution

Look at the log file in /usr/local/var/log/elasticsearch.log.

TL;DR

If you look at the formula definition with:

brew edit elasticsearch@6

You will find the content of the plist file used for this service, which define the output log as:

#{var}/log/elasticsearch.log

According to the documentation:

#var ⇒ Object

The directory where the formula's variable files should be installed. This directory is not inside the HOMEBREW_CELLAR so it persists across upgrades.

According to the source code:

def var
  HOMEBREW_PREFIX/"var"
end

You can find the HOMEBREW_PREFIX with:

brew --prefix

It is most likely /usr/local. So you will find your log file in /usr/local/var/log/elasticsearch.log.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top