Pro tip #2: Log with a view

Ever gotten stuck trying to remember that one grep command used to find the exact log lines you’re looking for? We’ve definitely been there and we know it can happen to the even the most talented dev ops teams.

But instead of having to remember the correct set of grep commands or filters, imagine simply clicking on an aptly named view to bring up all of the pertinent log lines. Welcome to the future of logging – complete with centralized aggregation and cloud access.

Inside the LogDNA web app, you can create these useful and nuanced views in three simple steps:

  1. Set the hosts, apps, and/or log level filters view using the All Hosts, All Apps, and All Levels menus in the top left.


  2. Optionally type search terms you want to select for and even set a start and/or end time window.


  3. Once you’re satisfied with what you see, click the Create View & Setup Alerts button, Name the view, and hit save.


On the left side of the web interface, you can find your saved views, including the one you just created. If you log out, and log back in, you can simply click on your new view and see exactly the log data you’re looking for.


Views are the bread and butter of dynamic logging, so make as many as you see fit. Go on, just view it!


Pro Tip #1: Adding the LogDNA agent

Now that you’ve signed up for LogDNA, it’s time to set up your server to run the LogDNA agent.

  1. Log into the LogDNA dashboard and find your API key. You can find it on the bottom left after clicking on Host Install Instructions, as shown below.

Adding LogDNA client to your host servers

2. Follow the instructions to get the LogDNA agent set up on your server


3. Specify your logging directories

By default, LogDNA logs all extensionless and .log files in /var/log/.

To add directories or files to log, you can use the commands:

logdna-agent -d /path/to/my/logfiles

logdna-agent -f /path/to/my/file.log

If you need more complex logic, you can also view and set specific paths (as well as glob patterns) in /etc/logdna.conf.

For example:

logdir = /var/log,/home/myuser/mylogdir,/etc/myapp/**.log

Glob patterns can be tricky, so unless you need this type of logic, we recommend using regular file paths. However, if you ever need a glob patterns reference guide, we recommend the wonderful Wikipedia.

Happy logging!