Agent services
addagent
This service creates a new agent. After creation, the new agent implements the basic configuration and can be managed via this API or the NXLog Manager user interface.
Type of Request: POST
URL: https://hostname:9443/nxlog-manager/mvc/restservice/addagent
Parameters are listed below.
Parameter | Description | Format | Type |
---|---|---|---|
|
Object specifying the characteristics of the agent being created. It contains
the |
XML or JSON object |
Required |
|
Unique name of the agent being created. If the request specifies the
|
String |
Required/Optional |
|
Object with several nested parameters which are listed below in this table. The first three parameters are required and define the minimum agent’s configuration, other are optional. |
XML or JSON |
Required |
|
Communication address or DNS hostname of the agent in case of the IPv4 and IPv6 addresses are supported. |
String |
Required |
|
Port associated with the |
Integer |
Required |
|
Fingerprint of the default certificate issuer which is used by the agent manager. To obtain the fingerprint information, you can run the certificateinfo service. |
String |
Required |
|
Fingerprint of the existing certificate which can be assigned to the agent during creation. If this parameter is omitted, a new certificate will be created and assigned to the agent. Such certificate uses the agent name and the default subject parameters according to the values from the Certificates tab. To obtain the certificate fingerprint of the existing certificate, you can run the certificateinfoservice. |
String |
Optional |
|
Specifies the Log to file
parameter configuration. The default value is |
Boolean |
Optional |
|
Severity level set by the LogLevel directive.
Accepts one of the following values: |
String |
Optional |
|
The connection mode the agent will use after creation.
Accepts the For more details, see the Connection type parameter description of the Agent Configuration topic. |
String |
Optional |
|
Verbatim configuration of the agent. After the agent has been created, this configuration is available in the Verbatim config field of the NXLog Manager user interface. |
String |
Optional |
curl -k -v POST "https://hostname:9443/nxlog-manager/mvc/restservice/addagent" -H "accept:application/json" -H "REST_PASSWORD: nxlog123" -H "REST_USER: admin" -H "Content-Type: application/json" -d "{ \"global-config\": { \"ca-fingerprint\":\"82cb807dea47e8c31a448e7496afa45d1922aa8\", \"address\": \"192.168.31.86\", \"port\": 9442, \"mode\": \"Listen\" }, \"name\": \"Agent_192.168.31.86\"}"
{
"servicename": "addagent",
"values": [
{
"message": "Agent 'Agent_192.168.31.86' is created."
}
],
"links": [
{
"rel": "self",
"href": "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/viewagentortemplate?name=Agent_192.168.31.86"
}
]
}
agentinfo
Retrieves information about NXLog agents registered with NXLog Manager.
Type of Request: GET
URL: https://hostname:9443/nxlog-manager/mvc/restservice/agentinfo
This service can accept the communication format specified via the .xml
or .json extensions appended to the end of the URL which can be used instead
of the accept and Content-Type headers.
For JSON format, the following URL should be used: https://hostname:9443/nxlog-manager/mvc/restservice/agentinfo.json .
The following URL should be used for XML: https://hostname:9443/nxlog-manager/mvc/restservice/agentinfo.xml .
|
Parameters are listed below. At least one parameter should be used to retrieve information.
Parameter | Description | Format | Type |
---|---|---|---|
|
A comma-delimited list of agent names for which information should be listed.
This parameter is mutually exclusive with the Can be combined with the |
Array[string] |
Optional |
|
Listing of agent information based on the state. In case of several states, this parameter can be specified for each state separately. The following states are available: Mutually exclusive with the This can be combined with the |
Array[string] |
Optional |
|
Listing of modules. This parameter can be combined with the |
Boolean |
Optional |
curl -k -v -H "REST_PASSWORD: nxlog123" -H "REST_USER: admin" "https://hostname:9443/nxlog-manager/mvc/restservice/agentinfo.json?agentstate=ONLINE&agentwithmodules=TRUE"
{
"servicename": "agentinfo",
"values": [
{
"content": {
"name": "192.168.31.86",
"version": "5.0.5874",
"status": "ONLINE",
"os": "Linux",
"address": "192.168.31.86",
"hostname": "nxlog",
"started": "2020-06-30 21:38",
"load": "0.01",
"memUsage": 1.0432512e7,
"received": 0,
"receivedToday": 0,
"processing": 0,
"sent": 0,
"sentToday": 0,
"lastOnline": "2020-07-03 23:43",
"sysinfo": "OS: Linux, Hostname: nxlog, Release: 3.10.0-1127.8.2.el7.x86_64, Version: #1 SMP Tue May 12 16:57:42 UTC 2020, Arch: x86_64, 2 CPU(s), 3.7Gb memory",
"modules": [
{
"module_name": "to_file",
"module": "om_file",
"module-type": 3,
"type": "OUTPUT",
"isRunning": true,
"evt-recvd": 0,
"queuesize": 0,
"evt-fwd": 0,
"evt-drop": 0,
"status": 3,
"module-status": "RUNNING",
"id": 24,
"serverInfo": {}
},
{
"module_name": "from_file",
"module": "im_file",
"module-type": 1,
"type": "INPUT",
"isRunning": true,
"evt-recvd": 0,
"queuesize": 0,
"evt-fwd": 0,
"evt-drop": 0,
"status": 3,
"module-status": "RUNNING",
"id": 23,
"serverInfo": {}
}
]
},
"links": [
{
"rel": "self",
"href": "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/agentinfo.json?agentname=192.168.31.86&agentwithmodules=true{&agentstate}"
},
{
"rel": "online_agents_with_modules",
"href": "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/agentinfo.json?agentstate=ONLINE&agentwithmodules=true{&agentname}"
},
{
"rel": "all_agents_with_modules",
"href": "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/agentinfo.json?agentwithmodules=true{&agentname,agentstate}"
}
]
}
],
"links": [
{
"rel": "self",
"href": "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/agentinfo.json?agentstate=ONLINE&agentwithmodules=true{&agentname}"
}
]
}
assigntemplatetoagent
Assigns the specified template to agents. Templates unify creation, configuration, tagging, and modification of agents. For more information, see the Templates section.
Type of Request: POST
URL: https://hostname:9443/nxlog-manager/mvc/restservice/assigntemplatetoagent
Parameters are listed below.
Parameter | Description | Format | Type |
---|---|---|---|
|
A comma-delimited list of agent UUIDs that should be assigned a (master)
template from the |
Array[string] |
Required |
|
List of sub templates to be assigned in addition to the main template from the
|
Array[string] |
Optional |
|
The name of a master template which has been created in NXLog Manager. |
String |
Optional |
|
If set to |
Boolean |
Optional |
curl -k -v -H "REST_PASSWORD: nxlog123" -H "REST_USER: admin" -H "accept: application/json" -H "Content-Type: application/json" -X POST "https://hostname:9443/nxlog-manager/mvc/restservice/assigntemplatetoagent?agentUuids=9f60f380-fbab-11e7-8000-d85ff4257f2a,ae50ea00-5ce4-11ec-8000-b4c3747b9c2c&templateName=Linux&subTemplateNames=Central,Linux_Security&updateAgents=true"
{
"servicename" : "assigntemplatetoagent",
"errors" : [
{
"status" : 0,
"message" : "192.168.31.219: Agent reconnect failed in 10 seconds."
},
{
"status" : 0,
"message" : "192.168.31.223: Agent reconnect failed in 10 seconds."
}
],
"values" : [
{
"message" : "192.168.31.219: Agent was assigned to master template 'Linux'."
},
{
"message" : "192.168.31.223: Agent was assigned to master template 'Linux'."
},
{
"message" : "192.168.31.219: Agent was assigned to subtemplate 'Central, Linux_Security'."
},
{
"message" : "192.168.31.223: Agent was assigned to subtemplate 'Central, Linux_Security'."
},
{
"message" : "192.168.31.219: Agent configuration updated successfully."
},
{
"message" : "192.168.31.223: Agent configuration updated successfully."
}
],
"links" : [
{
"rel" : "self",
"href" : "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/viewagentortemplate/192.168.31.219"
},
{
"rel" : "self",
"href" : "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/viewagentortemplate/192.168.31.223"
}
]
}
updateandreloadagent
Sends updated configuration from NXLog Manager to the specified agent and reloads it after the update. This service can be applied after configuring the agent in the NXLog Manager UI.
Type of Request: POST
URL: https://hostname:9443/nxlog-manager/mvc/restservice/updateandreloadagent
Parameters are listed below.
Parameter | Description | Format | Type |
---|---|---|---|
|
A comma-delimited list of agent UUIDs to be processed. If this parameter is omitted, all agents will be processed. |
Array[string] |
Optional |
|
If set to |
Boolean |
Optional |
|
In case of |
Boolean |
Optional |
curl -k -v -H "REST_PASSWORD: nxlog123" -H "REST_USER: admin" -H "accept: application/json" -H "Content-Type: application/json" -X POST "https://hostname:9443/nxlog-manager/mvc/restservice/updateandreloadagent?agentUuids=9f60f380-fbab-11e7-8000-d85ff4257f2a,ae50ea00-5ce4-11ec-8000-b4c3747b9c2c&forceOverrideLocalChanges=true"
{
"servicename" : "updateandreloadagent",
"values" : [
{
"message" : "192.168.31.219: Agent configuration updated successfully."
},
{
"message" : "192.168.31.219: Agent was reloaded successfully."
},
{
"message" : "192.168.31.223: Agent configuration updated successfully."
},
{
"message" : "192.168.31.223: Agent was reloaded successfully."
}
],
"links" : [
{
"rel" : "self",
"href" : "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/viewagentortemplate/192.168.31.219"
},
{
"rel" : "self",
"href" : "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/viewagentortemplate/192.168.31.223"
}
]
}
deleteagent
Deletes the specified agent either with or without revocation of the assigned certificate. Depending on the certificate revocation, the deleted agent can reconnect at a later time.
It is recommended to disable agents before deleting them.
Type of Request: DELETE
URL: https://hostname:9443/nxlog-manager/mvc/restservice/deleteagent
Parameters are listed below.
Parameter | Description | Format | Type |
---|---|---|---|
|
A comma-delimited list containing the UUIDs of the agents to be deleted. |
Array[string] |
Required |
|
If set to If set to The default value is |
Boolean |
Required |
curl -k -v -H "REST_PASSWORD: nxlog123" -H "REST_USER: admin" -H "accept: application/json" -H "Content-Type: application/json" -X DELETE "https://hostname:9443/nxlog-manager/mvc/restservice/deleteagent?agentUuids=9f60f380-fbab-11e7-8000-d85ff4257f2a&revokeCert=true"
In case the operations of agent deletion and certificate revocation have been performed successfully, this service returns a 204 No Content response.
If the revokeCert
parameter is set to FALSE
, the response will contain a
JSON structure according to the sample below.
{
"servicename": "deleteagent",
"values": [
{
"message": "192.168.31.145: Warning: Agent certificate should be revoked."
},
{
"message": "192.168.31.145: Agent was deleted!"
}
]
}
modifyagent
Modifies the existing agent configuration.
Type of Request: PUT
URL: https://hostname:9443/nxlog-manager/mvc/restservice/modifyagent
Parameters are listed below.
Parameter | Description | Format | Type |
---|---|---|---|
|
Specifies the name of the agent to be modified. Only one agent name per request can be used. |
String |
Required |
|
Object specifying the characteristics of the agent being created. It contains
the |
XML or JSON object |
Required |
|
The new unique name which will be used to replace the existing agent’s name.
In case the agent name needs to remain unaltered, this parameter should accept
the same name as the |
String |
Required |
|
Object containing several nested parameters which are listed below in this table. Three parameters are required, and other are optional. By providing new values to any of these parameters, the existing agent’s configuration can be altered. |
XML or JSON |
Required |
|
Communication address or DNS hostname of the agent in case of the IPv4 and IPv6 addresses are supported. |
String |
Required |
|
Port associated with the |
Integer |
Required |
|
Fingerprint of the default certificate issuer which is used by the agent manager. To obtain the fingerprint information, you can run the certificateinfo service. |
String |
Required |
|
Fingerprint of the existing certificate which can be assigned to the agent after modification. To obtain the certificate fingerprint, you can run the certificateinfo service. |
String |
Optional |
|
Specifies the Log to file
parameter configuration. The default value is |
Boolean |
Optional |
|
Severity level set by the LogLevel directive.
Accepts one of the following values: |
String |
Optional |
|
Connection mode the agent will use after modification. The parameter accepts
the For more details, see the Connection type parameter description of the Agent configuration topic. |
String |
Optional |
|
Verbatim configuration which will be used by the agent after modification. This configuration will be available in the Verbatim config field of the NXLog Manager user interface. |
String |
Optional |
curl -k -v -X PUT "https://hostname:9443/nxlog-manager/mvc/restservice/modifyagent?agentName=Agent_192.168.31.86" -H "accept: application/json" -H "REST_PASSWORD: nxlog123" -H "REST_USER: admin" -H "Content-Type: application/json" -d "{ \"global-config\": { \"ca-fingerprint\": \"82cb807dea47e8c31a448e7496afa45d1922aa8\", \"address\": \"192.168.31.218\", \"mode\": \"Listen\", \"port\": 9442 }, \"name\": \"Agent_192.168.31.218\"}"
{
"servicename": "modifyagent",
"values": [
{
"message": "Agent global configuration saved successfully."
}
],
"links": [
{
"rel": "self",
"href": "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/viewagentortemplate?name=Agent_192.168.31.218"
}
]
}
startagent
Sends a restart request to the specified agents, causing each agent service to reload its configuration and restart its modules.
Type of Request: POST
URL: https://hostname:9443/nxlog-manager/mvc/restservice/startagent
Parameters are listed below.
Parameter | Description | Format | Type |
---|---|---|---|
|
A comma-delimited list of agent UUIDs to be restarted. |
Array[string] |
Required |
curl -k -v -H "REST_PASSWORD: nxlog123" -H "REST_USER: admin" -H "accept: application/json" -H "Content-Type: application/json" -X POST "https://hostname:9443/nxlog-manager/mvc/restservice/startagent?agentUuids=9f60f380-fbab-11e7-8000-d85ff4257f2a,ae50ea00-5ce4-11ec-8000-b4c3747b9c2c"
stopagent
Sends a server_stop
call to stop all running modules for each agent
specified.
Type of Request: POST
URL: https://hostname:9443/nxlog-manager/mvc/restservice/stopagent
Parameters are listed below.
Parameter | Description | Format | Type |
---|---|---|---|
|
A comma-delimited list of agent UUIDs to be stopped. |
Array[string] |
Required |
curl -k -v -H "REST_PASSWORD: nxlog123" -H "REST_USER: admin" -H "accept: application/json" -H "Content-Type: application/json" -X POST "https://hostname:9443/nxlog-manager/mvc/restservice/stopagent?agentUuids=9f60f380-fbab-11e7-8000-d85ff4257f2a,ae50ea00-5ce4-11ec-8000-b4c3747b9c2c"
{
"servicename" : "stopagent",
"values" : [
{
"message" : "192.168.31.219: Agent was stopped successfully."
},
{
"message" : "192.168.31.223: Agent was stopped successfully."
}
],
"links" : [
{
"rel" : "self",
"href" : "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/viewagentortemplate/192.168.31.219"
},
{
"rel" : "self",
"href" : "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/viewagentortemplate/192.168.31.223"
}
]
}
setcustomlabel
Depending on the parameters, this service either creates a new custom label or updates existing ones.
Type of Request: POST
URL: https://hostname:9443/nxlog-manager/mvc/restservice/setcustomlabel
Parameters are listed below.
Parameter | Description | Format | Type |
---|---|---|---|
|
Object which describes the label, and contains the |
XML or JSON object |
Required |
|
A comma-delimited list of agents to assign the label to. If this parameter is not specified for a new label, the label remains unassigned after creation. When used for existing labels, this parameter updates the label value for the specified agents. If this parameter is not specified, the label value will be updated for all agents the label was previously assigned to. |
Array[string] |
Optional |
|
The actual name of the label which will be renamed with the new name as per
the |
String |
Optional |
|
If set to The default value is |
Boolean |
Optional |
|
If set to The default value is |
Boolean |
Optional |
curl -k -v -X POST "https://hostname:9443/nxlog-manager/mvc/restservice/setcustomlabel?agentUuids=9f60f380-fbab-11e7-8000-d85ff4257f2a" -H "accept:application/json" -H "REST_PASSWORD: nxlog123" -H "REST_USER: admin" -H "Content-Type: application/json" -d "{\"name\": \"LabelOne\", \"value\": \"LabelValue\"}"
{
"servicename": "setcustomlabel",
"links": [
{
"rel": "self",
"href": "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/setcustomlabel&agentUuids=9f60f380-fbab-11e7-8000-d85ff4257f2a?setForAgentsOnly=false&scheduledUpdate=false{&oldName,agentUuids}"
}
]
}
removecustomlabel
Depending on the parameters, this service can perform the following actions:
-
Unassign the existing labels from agents
-
Completely remove the labels
Type of Request: POST
URL: https://hostname:9443/nxlog-manager/mvc/restservice/removecustomlabel
Parameters are listed below.
Parameter | Description | Format | Type |
---|---|---|---|
|
A comma-delimited list of label names which should be unassigned from agents or removed. The labels are removed from the system if they were not previously assigned to
any agents, or the The labels are unassigned from the agents according to the values of the
|
Array[string] |
Required |
|
A comma-delimited list of agents the labels should be unassigned from. The list
of labels are specified as per the In case the |
Array[string] |
Optional |
curl -k -v -X POST "https://hostname:9443/nxlog-manager/mvc/restservice/removecustomlabel?labelNames=LabelOne,LabelTwo&agentUuids=ae50ea00-5ce4-11ec-8000-b4c3747b9c2c" -H "accept:application/json" -H "REST_PASSWORD: nxlog123" -H "REST_USER: admin" -H "Content-Type: application/json"
{
"servicename": "removecustomlabel",
"links": [
{
"rel": "self",
"href": "https://hostname:9443/nxlog-manager/mvc/mvc/restservice/removecustomlabel{pathExt:.*}?labelNames=LabelOne&labelNames=LabelTwo&agentUuids=ae50ea00-5ce4-11ec-8000-b4c3747b9c2c"
}
]
}
Please Log in and try again.