What if I told you that it took me just under 10 minutes, 8 commands and 6 mouse clicks to create this bar chart informing me — big surprise — that I have too many open tabs in Chrome on my Mac? chart

That might sound like a lot to some readers, but if you’re not a stranger to ELK you’ll know that installing the stack, even for testing and development purposes, usually involves a whole lot more than that. 

ELK can be installed on almost any system and in any environment. Mac OS X is no exception to this rule and a new official Homebrew tap developed by Elastic makes this procedure super easy.

What is Homebrew?

Homebrew is a popular open source package manager that makes installing software on Mac OS X much simpler. Instead of downloading the bundle’s source code manually, unarchiving it, and then configuring and running it, all you have to do is enter one simple command in your CLI. 

Homebrew will download the source code, figure out if there are any dependencies, and download and compile them as well if necessary. It will then build the requested software and install it in one common location for easier access and updating. Homebrew’s inner workings and terminology are pretty straightforward but if you want to find out more, check out the docs

What makes Homebrew so popular, especially among developers, is first and foremost, its ease of use and simplicity. Coupled with extensibility, one can easily understand why it’s probably the most popular package manager for Mac.

Let’s see how the new Homebrew tap can be used to set up ELK on your Mac. 

Installing Homebrew

If you’ve already got Homebrew setup, feel free to skip to the next step. If not, here are the instructions you’ll need to install it. 

As prerequisites, you’ll need a Mac of course (preferably running Mac OS X 10.10 or later), a CLI (Terminal works just fine) and some basic command line knowledge:

It should take a minute or two to install, after which, run the next command to verify the installation: 

If you see some usage examples displayed, Homebrew has installed successfully. 

Installing ELK

To install the ELK Stack, we will first install the new tap containing all of the Formulae for the different components in the stack:

A total of 18 formulae are “tapped” as the output message informs us:

Next, we’ll install Elasticsearch, Kibana, and Metricbeat (if you want to install the open source version of these components, simply replace -full with -oss):

Homebrew will download and install Elasticsearch. This might take a minute or two: 

As instructed, run Elasticsearch with:

Or simply:

To make sure, cURL Elasticsearch with:

You should see the following output:

Next, install Kibana with:

Kibana is downloaded and installed. And the output:

To run Kibana in the background, use: 

Or: 

To access Kibana, open your browser at: 

You should see Kibana’s welcome screen:

kibana

Next, let’s set up a simple data pipeline going using Metricbeat to ship some system metrics from our Mac:

Metricbeat is a much smaller package, so it’ll take just a few seconds to be downloaded and installed:

Again, to start Metricbeat you can use either of the following two commands:

OR

Within a minute or two, Metricbeat will begin shipping system metrics to Elasticsearch. You can verify by listing Elasticsearch indices:

All you need to do now to start analyzing your Mac’s performance is define the new Metricbeat index pattern in Kibana. 

Go to the management → Kibana → Index patterns page. You’ll see Kibana has automatically identified the new Elasticsearch index:

create index pattern

Define it as requested, proceed to the next step of selecting the @timestamp field, and create the new index pattern. 

You can then open the Discover page to start analyzing your data:

discover

From the list of available fields on the left, click the processname field and then the Visualize button. 

A bar chart showing the most used processes my Mac is displayed:

chart

Summing it up

I’m not great at math, but if I counted correctly, that’s eight simple commands to set up a development ELK Stack if you don’t have Homebrew installed. Two more clicks to get a useful visualization displayed! 

So, a very simple way of getting started with the ELK Stack on Mac OS X and recommended for those users playing around and just getting their feet wet. You can still install the stack using the conventional method of course, but seriously — why would you do that? 

Monitor, troubleshoot, and secure your environment with Logz.io's ELK-as-a-service.