Log Insight: Configuration APIs

A few months back, I blogged about Log Insight GET configuration APIs. At the time, my goal was to provide a set of BASH functions that could be used to call Log Insight APIs and also to provide some minimum documentation on the Tech Preview configuration APIs in Log Insight 3.6. For one of my vBrownBag sessions at VMworld, I updated these functions and included some POST configuration APIs as well. Read on to learn more!

li-logo

After playing around with my initial BASH functions a bit, I realized the following changes would be beneficial:

  • Use port 9543 (cfapi over TLS) instead of 443 (HTTPS) for all API calls (some require this)
  • Better messaging when running liauth
  • Clearing of environment variable only with properly authenticated liauth calls
  • Some POST commands (ingest + configuration)
  • Header in returned results (so you know when you are using a Tech Preview API)

The last change does result in different behavior of returned results and may break any scripts leveraging the old return value of the previous BASH functions. You can simply just take the last line of the returned result to get back to default behavior (i.e. tail -n 1). In the future, I may add a command line option to handle this.

With the POST additions you can now call the query API with something like:

You can also call POST configuration APIs such as the deployment API with something like:

Here is a carry over example of how to get agent statistics from my previous blog post:

Because I was asked explicitly about leveraging the event forwarder part of the configuration API, I have included this as well:

BONUS: I have also included a ncevent BASH function which can be used to send events from the CLI via netcat.

You can find the latest Log Insight BASH functions here. As always, feedback is welcome and I am accepting pull requests!

© 2016, Steve Flanders. All rights reserved.

Leave a Reply