Heroku does not have the built-in capability to search our logs from the command line. We can get around this limitation easily by making use of some other command-line tools.
In this recipe, we will learn how to combine Heroku's logs with Grep, a command-line tool to search text. This will allow us to search our recent logs for keywords, helping us track down errors more quickly.
For this recipe, we'll need to have Grep installed. For OS X and Linux machines, it should already be installed. We can install Grep using the following steps:
To check if we have Grep installed, let's open up a terminal and type the following:
$ grep usage: grep [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]] [-e pattern] [-f file] [--binary-files=value] [--color=when] [--context[=num]] [--directories=action] [--label] [--line-buffered] [--null] [pattern] [file ...]
If we do not see usage instructions, we can visit http://www.gnu.org/software/grep/...