How to Log Messages from Slack

how-to-log-from-slack

We recently added support for unedited HTTP logging in Logentries. This means you can send us log data via HTTPS drain (from heroku), or via any webhook you want.

One webhook that we’ve been looking to log for a while is Slack.

People are always chatting away on Slack, and this data might be useful some day. You can send the data into Logentries however you want, and then worry about what to do it when you actually need it!

First, you’ll need to add the Outgoing Webhook integration to Slack.
Click this link, and sign in.

Choose the public channel you want to log from (currently, Slack only lets you log from a specific channel, so you’ll need to manually set this up for each channel you want to log), or choose a keyword to log if you want to log all chatrooms.

Note that slack doesn’t allow you to log all of your data currently, which means the URL you need will be: https://webhook.logentries.com/webhook/logs/TOKEN.

Then save and it’s done. You’ll start to see log data streaming in as people yammer away to each other, and it’ll start to look like this:

slack_log_view

As you might be able to tell from the blue coloring, we parse this data as Key Value Pairs, thanks to Logentries’ flexible and automated indexing.

You can query all of that data too! The simplest query is to check how many people have chatted in the room over the past while:
calculate(unique:user_name)

slack_linegraph_view

That spike at 10:15 is when I asked people to talk for a bit in the demonstrative slack room, so it checks out.

Next, I could see how much each person talked: groupby(user_name) calculate(count)

slack_calculate_view

Of course, now that we allow slack logging on top of our Slack alerts, there are all sorts of fun new possibilities:

slack_tag_view

Interested in logging from Slack? Create your free Logentries account here.

Posted in How To, Monitoring

Leave a Reply