Template services

addmastertemplate

Creates a master configuration template which can be applied to agents.

Type of Request: POST

URL: https://hostname:9443/nxlog-manager/mvc/restservice/addmastertemplate

Parameters are listed below.

Table 1. List of parameters
Parameter Description Format Type

masterTemplate

Object containing all configuration parameters of the template being created. It specifies the name, description, and global-config nested key-value pairs which are listed below in this table.

XML or JSON object

Required

name

The unique name for the template.

String

Required

description

The arbitrary description of the template.

String

Optional

global-config

Object with several nested configuration parameters which are listed in the rows below. The first three parameters are required and define the minimum configuration of the template, and others are optional.

XML or JSON object

Required

ca-fingerprint

Fingerprint of the certificate authority which was used for issuing the Manager server certificate.

To obtain information about the fingerprint, you can run the certificateinfo service.

String

Required

address

Communication address or DNS hostname of the agent in case of the Listen mode, or the manager address if the Connect mode should be configured. For more information, see the mode parameter of this service.

IPv4 and IPv6 addresses are supported.

String

Required

port

Port associated with the address parameter.

Integer

Required

is-log-to-file

Specifies the Log to file parameter configuration. The default value is TRUE, which enables the local nxlog.log file to write NXLog agent internal events to.

Boolean

Optional

log-level

Severity level as per the LogLevel directive. Accepts one of the following values: DEBUG, INFO, WARNING, ERROR, or CRITICAL. The default value is INFO.

String

Optional

mode

The connection mode the agent will use after creation. Accepts the Connect, Listen, or Unmanaged values. The default value is Connect.

For more details, see the Connection Type parameter description of the Agent Configuration topic.

String

Optional

verbatim

Verbatim configuration of the agents, which is available in the Verbatim config field of the NXLog Manager user interface.

String

Optional

Sample cURL request
curl -k -v POST "https://hostname:9443/nxlog-manager/mvc/restservice/addmastertemplate" -H  "accept:application/json" -H  "REST_PASSWORD: nxlog123" -H  "REST_USER: admin" -H  "Content-Type: application/json" -d "{  \"description\":\"The template description\",\"global-config\": { \"ca-fingerprint\":\"eeba4ac8654e0ec7e52ad8732f56c5c879c217\", \"address\": \"192.168.31.80\", \"port\": 9442,\"is-log-to-file\":true, \"log-level\":\"INFO\", \"verbatim\":\"<Input from_null>\nModule im_null\n</Input>\n\n<Output to_null>\nModule om_null\n</Output>\n\n<Route r1>\nPath from_null => to_null\n</Route>\", \"mode\": \"Listen\" }, \"name\": \"Agent_mastertemplate\"}"
Sample response in JSON
{
    "servicename" : "addmastertemplate",
    "values" : [ {
      "message" : "Template 'Agent_mastertemplate' is created."
    } ],
    "links" : [ {
      "rel" : "self",
      "href" : "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/viewagentortemplate?name=Agent_mastertemplate"
    } ]
  }

addsubtemplate

Creates an auxiliary configuration template which can be applied in addition to a master template.

To work properly, configuration of the master and auxiliary templates must diverge. For more details, see the Planning section of the Templates chapter.

Type of Request: POST

URL: https://hostname:9443/nxlog-manager/mvc/restservice/addsubtemplate

Parameters are listed below.

Table 2. List of parameters
Parameter Description Format Type

subTemplate

Object containing all configuration parameters of the template being created. It specifies the name, description, and global-config nested key-value pairs which are listed below in this table.

XML or JSON object

Required

name

The unique name for the template.

String

Required

description

The arbitrary description of the template.

String

Optional

global-config

Object containing the verbatim nested parameter.

XML or JSON object

Optional

verbatim

Verbatim configuration available in the Verbatim config field of the NXLog Manager user interface.

String

Optional

Sample cURL request
curl -k -v POST "https://hostname:9443/nxlog-manager/mvc/restservice/addsubtemplate" -H  "accept:application/json" -H  "REST_PASSWORD: nxlog123" -H  "REST_USER: admin" -H  "Content-Type: application/json" -d "{  \"description\":\"the subtemplate_one\",\"global-config\": { \"verbatim\":\"<Extension json>\nModule xm_json\n</Extension>\" }, \"name\": \"Agent_subtemplate\"}"
Sample response in JSON
{
    "servicename" : "addsubtemplate",
    "values" : [ {
      "message" : "Template 'Agent_subtemplate' is created."
    } ],
    "links" : [ {
      "rel" : "self",
      "href" : "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/viewagentortemplate?name=Agent_subtemplate"
    } ]
  }

modifymastertemplate

Modifies the existing master template which had already been created using the [addmastertemplate].

Type of Request: PUT

URL: https://hostname:9443/nxlog-manager/mvc/restservice/modifymastertemplate

Parameters are listed below.

Table 3. List of parameters
Parameter Description Format Type

masterTemplateName

Name of the master template to be modified.

String

Required

masterTemplate

Object with the description of all modifications to be done over the template. It specifies the name, description, and global-config nested key-value pairs which are listed below in this table.

XML or JSON object

Required

name

The unique template name which will be used after modification.

String

Required

description

The description which will be applied after the template modification.

String

Optional

global-config

Object with several nested configuration parameters which are listed below in this table. The first three parameters are required and define the minimum configuration after modification, and others are optional.

XML or JSON object

Required

ca-fingerprint

Fingerprint of the certificate authority which was used for issuing the Manager server certificate.

To obtain information about the fingerprint, you can run the certificateinfo service.

String

Required

address

Communication address or DNS hostname of the agent in case of the Listen mode, or the manager address if the Connect mode should be configured. For more information, see the mode parameter of this service.

IPv4 and IPv6 addresses are supported.

String

Required

port

Port associated with the address parameter.

Integer

Required

is-log-to-file

Specifies the Log to file parameter configuration. The default value is TRUE, which enables the local nxlog.log file to write NXLog agent internal events to.

Boolean

Optional

log-level

Severity level as per the LogLevel directive. Accepts one of the following values: DEBUG, INFO, WARNING, ERROR, or CRITICAL. The default value is INFO.

String

Optional

mode

The connection mode the agent will use after creation. Accepts the Connect, Listen, or Unmanaged values. The default value is Connect.

For more details, see the Connection type parameter description of the Agent Configuration topic.

String

Optional

verbatim

Verbatim configuration of the agents, which is available in the Verbatim config field of the NXLog Manager user interface.

String

Optional

Sample cURL request
curl -k -v -X PUT "https://127.0.0.1:9443/nxlog-manager/mvc/restservice/modifymastertemplate?masterTemplateName=Agent_mastertemplate" -H  "accept:application/json" -H  "REST_PASSWORD: nxlog123" -H  "REST_USER: admin" -H  "Content-Type: application/json" -d "{  \"description\":\"the template\",\"global-config\": { \"ca-fingerprint\":\"eeba4ac8654e0ec7e52ad8732f56c5c879c217\", \"address\": \"192.168.31.85\", \"port\": 9440,\"is-log-to-file\":false, \"log-level\":\"INFO\", \"verbatim\":\"<Input 1>Module im_internal</Input><Output 2>Module om_null</Output><Route r1>Path 1 => 2</Route>\", \"mode\": \"Listen\" }, \"name\": \"Agent_mastertemplate_modified\"}"
Sample response in JSON
{
    "servicename" : "modifymastertemplate",
    "values" : [ {
      "message" : "Template global configuration saved successfully."
    } ],
    "links" : [ {
      "rel" : "self",
      "href" : "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/viewagentortemplate?name=Agent_mastertemplate_modified"
    } ]
  }

modifysubtemplate

Modifies the existing auxiliary template which had already been created using the addsubtemplate.

To work properly, configuration of the master and auxiliary templates must diverge. For more details, see the Planning section of the [Templates] topic.

Type of Request: PUT

URL: https://hostname:9443/nxlog-manager/mvc/restservice/modifysubtemplate

Parameters are listed below.

Table 4. List of parameters
Parameter Description Format Type

subTemplateName

Name of the template to be modified.

String

Required

subTemplate

Object with the description of all modifications to be done over the template. It specifies the name, description, and global-config nested key-value pairs which are listed below in this table.

XML or JSON object

Required

name

The unique name which will be assigned to the template after modification.

String

Required

description

The description which will be applied after the template modification.

String

Optional

global-config

Object containing the verbatim nested parameter.

XML or JSON object

Optional

verbatim

Verbatim configuration available in the Verbatim config field of the NXLog Manager user interface.

String

Optional

Sample cURL request
curl -k -v -X PUT "https://hostname:9443/nxlog-manager/mvc/restservice/modifysubtemplate?subTemplateName=Agent_subtemplate" -H  "accept:application/json" -H  "REST_PASSWORD: nxlog123" -H  "REST_USER: admin" -H  "Content-Type: application/json" -d "{  \"description\":\"The Agent_subtemplate modified description\",\"global-config\": { \"verbatim\":\"<Extension syslog>\nModule xm_syslog\n</Extension>\" }, \"name\": \"Agent_subtemplate_modified\"}"
Sample response in JSON
{
    "servicename" : "modifysubtemplate",
    "values" : [ {
      "message" : "Template global configuration saved successfully."
    } ],
    "links" : [ {
      "rel" : "self",
      "href" : "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/viewagentortemplate?name=Agent_subtemplate_modified"
    } ]
  }