Logs, Backups and Sorting in Bach - Noteworthy at Compose

Published

This is your weekly summary of Compose news for those changes and updates which can make your life easier. In this September 24th 2018 edition, we look at a handy addition to the "bach" command line and we also take a browse through the past week's Compose Articles.

Logs, Backups and Sorting in Bach

We've just added a a whole set of new features to Bach to make Bach 0.5.0. If you've not met Bach, it's a command line interface for working with your Compose database deployments. Not the querying part, but the administration - checking on backups and deployments, checking for certificates, managing users and teams and creating and de-provisioning databases.

If you haven't got Bach installed yet, you can read about it in the blog, most recently about adding name support or in the documentation; the documentation contains links to the Bach releases download page too.

Now on to the new features:

Logfile Listing and Getting

For various reasons, Bach omitted support for listing and retrieving logfiles from deployments. Well, thats now fixed and it's all quite similar to how Backups are handled. The base command is logfiles and it has two subcommands, list and get. If you run this:

$ bach logfiles list WiredForTigers
     Logfile ID: 5ba2eefab048d70015763162
  Deployment ID: 56aa59b06adb6b000e000021
     Capsule ID: 56aa59b16adb6b000e000026
   Logfile Name: mongodb186.log-2018-09-19.gz
         Status: success

     Logfile ID: 5ba19e2a1bc7a8000e27c28f
  Deployment ID: 56aa59b06adb6b000e000021
     Capsule ID: 56aa59b16adb6b000e000026
   Logfile Name: mongodb186.log-2018-09-18.gz
         Status: success

     Logfile ID: 5ba04d084ce0d90d9ad15e84
  Deployment ID: 56aa59b06adb6b000e000021
     Capsule ID: 56aa59b16adb6b000e000026
   Logfile Name: mongodb186.log-2018-09-17.gz
         Status: success
...

Each entry represents an available logfile, each with its own unique id. The Deployment ID shows which deployment this logfile belongs to and the Capsule ID shows the component of the deployment which generated that log. Don't worry though, everything you need to know is in the Logfile name: the first part is the component name, as displayed in the overview in the Compose console. If I look in the overview...

Topology Overview

I can see that mongodb186 is a data member of the MongoDB cluster. And the rest of the file name is the date that this log is for.

Now, if I want to find out more, I can use the get command with the deployment id and the backup id. Let's get the log for the 19th:

$ bach logfiles get WiredForTigers 5ba2eefab048d70015763162
     Logfile ID: 5ba2eefab048d70015763162
  Deployment ID: 56aa59b06adb6b000e000021
     Capsule ID: 56aa59b16adb6b000e000026
   Logfile Name: mongodb186.log-2018-09-19.gz
         Status: success
  Download Link: https://compose-logs.s3.amazonaws.com/compose/aws-eu-west-1-data.7.dblayer.com/mongodb186/mongodb186.log-2018-09-19.gz?....

Basically the same information, but now with an added download link so we can retrieve the logfile. But who's got time to cut and paste. Add the --download (or -d) flag to the command and it'll automatically download the file, complete with progress of the download.

bach logfiles get WiredForTigers 5ba2eefab048d70015763162 -d  
     Logfile ID: 5ba2eefab048d70015763162
  Deployment ID: 56aa59b06adb6b000e000021
     Capsule ID: 56aa59b16adb6b000e000026
   Logfile Name: mongodb186.log-2018-09-19.gz
         Status: success
  Download Link: https://compose-logs.s3.amazonaws.com/compose/aws-eu-west-1-data.7.dblayer.com/mongodb186/mongodb186.log-2018-09-19.gz?...
Downloading... 313 kB complete  
Downloaded: mongodb186.log-2018-09-19.gz  
$

So now you can locate and download your logs from Bach.

Backups extra

That download feature seemed to be exceptionally handy, so we also added it to the bach backups get command. Simple add -d to your get and the backup will be downloaded automatically for you.

Sorting time

Back to the sorting options. We'd been asked to make life a little easier on users who have a lot of different databases. Previous versions of Bach's list command listed the deployments in the order they came out of the API. We provided type and name filters to help, but we were reminded that sorting the lists was probably going to help people just browsing their databases.

So we added, not one but three sorting options. Now you can sort your databases deployments list by id, by name or by type. We've left the old unsorted behavior as default. To sort by name, add -n, by id, -i and by database type, -d. There's longer name versions of those flags, but we're assuming you won't want to type those out.

Happy sorted lists! And remember, if there's something you'd like to see in Bach or you notice a bug, drop a ticket in the Bach issues tracker and we'll see what we can do.

Compose Articles

Last week in Compose Articles we...

That's it for this week's Noteworthy at Compose. Onwards to next week!

Dj Walker-Morgan
Dj Walker-Morgan is Compose's resident Content Curator, and has been both a developer and writer since Apples came in II flavors and Commodores had Pets. Love this article? Head over to Dj Walker-Morgan’s author page to keep reading.

Conquer the Data Layer

Spend your time developing apps, not managing databases.