How to enable and disable log forwarding to Log Insight (LI) system via API
search cancel

How to enable and disable log forwarding to Log Insight (LI) system via API

book

Article ID: 397000

calendar_today

Updated On:

Products

VCF Automation

Issue/Introduction

Log forwarding to the Log Insight (LI) system is enabled by default through LCM, and there is currently no option available for customers to disable this setting through the user interface; hence, this article explains how to disable and enable log forwarding to the LI system via API.

Environment

VCF Automation 9.0, VCF Identity Broker 9.0

Resolution

The LCM Proxy API provides the mechanism to invoke the webhook to enable or disable Log Insight and configure its associated properties.

The following API is used to invoke actions for a specific product within a given environment and can be used to configure Log Insight (LI) settings, including enabling or disabling log forwarding. 

Endpoint
POST /lcm/lcops/api/environments/{environmentId}/products/{productId}/actions/invoke

Parameters

Parameter
Description
environmentId Unique ID of the environment
productId Product name

 

Request Body Fields

Field
Description
name Name of the action
ref Webhook reference
version Version of the webhook
properties

Contains the configuration object with properties based on the action that needs to be triggered.

 

LogInsight Configuration Object Properties

Properties
Type
Description
Required 
agentid number Agent id. Defaults to 0 Yes
enable boolean Enable or disable logging. Defaults to true No
host string

Host name or IPv

Yes

port number

Port for forwarding the logs. Defaults to 9543

No

username string

Username of the LI

Yes

password string

Password of the LI

Yes

scheme enum

Transport scheme(http/https). Defaults to https

No

sslverify boolean

Enable/Disable ssl verification. Defaults to false

No

cacert string

Stringified content of ca certificate file.
Eg: cat vmsp.crt | jq -asR

Yes

 

To configure and enable LI, set the enable parameter to true with its required properties

Sample Request
curl -X POST "https://<lcm-ip>/lcm/lcops/api/environments/{environmentId}/products/vidb/actions/invoke" \
  -H "accept: application/json" \
  -H "Authorization: Basic <authorization_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name""loginsightconfig",
    "ref""/webhooks/core/loginsightconfig/configure",
    "version""v1",
    "properties": {
       "host""li.example.com",
       "port"9543,
       "scheme""https",
       "agentid"3,
       "cacert""-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----",
       "username""admin",
       "password""password",
       "enable"true,
       "sslverify"false
    }
  }'
Response
{
  "requestId""request_id"
}

 

To disable LI, set the enable parameter to false

Sample Request
curl -X POST "https://<lcm-ip>/lcm/lcops/api/environments/{environmentId}/products/vidb/actions/invoke" \
  -H "accept: application/json" \
  -H "Authorization: Basic <authorization_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name""loginsightconfig",
    "ref""/webhooks/core/loginsightconfig/configure",
    "version""v1",
    "properties": {
       "host""li.example.com",
       "agentid"3,
       "cacert""-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----",
       "username""admin",
       "password""password",
       "enable"false
    }
  }'
Response
{
  "requestId""request_id"
}