Follow these steps to configure the Versa Analytics Log Collector using REST API:
- Add a new local collector.
POST http://10.40.24.76:8008/api/config/log-collector-exporter/local/collectors/ Accept: application/vnd.yang.collection+json Content-Type: application/vnd.yang.data+json { "collector": { "collector-name": "lc11", "address": "10.40.24.76", "port": 1234, "storage": { "directory": "/var/tmp/log", "format": "syslog" } } }
-- response -- 201 Created Cache-Control: private, no-cache, must-revalidate, proxy-revalidate Content-Length: 0 Content-Type: text/html Date: Mon, 25 Sep 2017 20:31:43 GMT Etag: 1506-371503-825148 Last-Modified: Mon, 25 Sep 2017 20:31:43 GMT Location: http://10.40.24.76:8008/api/config/log-collector-exporter/local/collectors/collector/lc11 Pragma: no-cache Server:
- List all the local collectors.
GET http://10.40.24.76:8008/api/config/log-collector-exporter/local/collectors/collector Accept: application/vnd.yang.collection+json
-- response -- 200 OK Cache-Control: private, no-cache, must-revalidate, proxy-revalidate Content-Type: application/vnd.yang.collection+json Date: Mon, 25 Sep 2017 20:32:41 GMT Pragma: no-cache Server: Transfer-Encoding: chunked { "collection": { "lced:collector": [ { "collector-name": "lc11", "address": "10.40.24.76", "port": 1234, "storage": { "directory": "/var/tmp/log", "format": "syslog" } } ] } }
- Modify the collector parameters.
PUT http://10.40.24.76:8008/api/config/log-collector-exporter/local/collectors/ Accept: application/vnd.yang.collection+json Content-Type: application/vnd.yang.data+json { "collectors": { "collector": { "collector-name": "lc11", "address": "10.40.24.76", "port": 12234, "storage": { "directory": "/var/tmp/log", "format": "syslog" } } } }
-- response -- 204 No Content Cache-Control: private, no-cache, must-revalidate, proxy-revalidate Content-Length: 0 Content-Type: text/html Date: Mon, 25 Sep 2017 20:24:22 GMT Etag: 1506-371062-130737 Last-Modified: Mon, 25 Sep 2017 20:24:22 GMT Pragma: no-cache Server:
- Delete all the collectors.
DELETE http://10.40.24.76:8008/api/config/log-collector-exporter/local/collectors/collector Accept: application/vnd.yang.collection+json
-- response -- 204 No Content Cache-Control: private, no-cache, must-revalidate, proxy-revalidate Content-Length: 0 Content-Type: text/html Date: Mon, 25 Sep 2017 20:37:39 GMT Etag: 1506-371859-507818 Last-Modified: Mon, 25 Sep 2017 20:37:39 GMT Pragma: no-cache Server:
- Add a remote template.
POST http://10.40.24.76:8008/api/config/log-collector-exporter/remote/templates/ Accept: application/vnd.yang.collection+json Content-Type: application/vnd.yang.data+json { "template": { "template-name": "rt1", "type": "syslog" } }
-- response -- 201 Created Cache-Control: private, no-cache, must-revalidate, proxy-revalidate Content-Length: 0 Content-Type: text/html Date: Sat, 23 Sep 2017 01:15:12 GMT Etag: 1506-129312-849113 Last-Modified: Sat, 23 Sep 2017 01:15:12 GMT Location: http://10.40.24.76:8008/api/config/log-collector-exporter/remote/templates/template/rt1 Pragma: no-cache Server:
- Add a remote collector.
POST http://10.40.24.76:8008/api/config/log-collector-exporter/remote/collectors Accept: application/vnd.yang.collection+json Content-Type: application/vnd.yang.data+json { "collector": { "remote-collector-name": "director-collector", "destination-address": "192.168.101.3", "destination-port": 20514, "source-address": "192.168.101.4", "transport": "tcp", "template": "rt1" } }
-- response -- 201 Created Cache-Control: private, no-cache, must-revalidate, proxy-revalidate Content-Length: 0 Content-Type: text/html Date: Sat, 23 Sep 2017 01:20:18 GMT Etag: 1506-129618-391348 Last-Modified: Sat, 23 Sep 2017 01:20:18 GMT Location: http://10.40.24.76:8008/api/config/log-collector-exporter/remote/collectors/collector/director-collector Pragma: no-cache Server:
- Add a remote profile.
POST http://10.40.24.76:8008/api/config/log-collector-exporter/remote/profiles/ Accept: application/vnd.yang.collection+json Content-Type: application/vnd.yang.data+json { "profile": { "profile-name": "director-profile", "collector": "director-collector" } } }
-- response -- 201 Created Cache-Control: private, no-cache, must-revalidate, proxy-revalidate Content-Length: 0 Content-Type: text/html Date: Sat, 23 Sep 2017 01:23:19 GMT Etag: 1506-129800-15392 Last-Modified: Sat, 23 Sep 2017 01:23:20 GMT Location: http://10.40.24.76:8008/api/config/log-collector-exporter/remote/profiles/profile/director-profile Pragma: no-cache Server:
- Add exporter rules.
POST http://10.40.24.76:8008/api/config/log-collector-exporter/exporter/rules Accept: application/vnd.yang.collection+json Content-Type: application/vnd.yang.data+json { "rule": { "rule-name": "Director-Forward", "match": { "local-collector": "lc11", "log-types": [ "alarm-log" ] }, "set": { "remote-collector-profile": "director-profile" } } }
-- response -- 201 Created Cache-Control: private, no-cache, must-revalidate, proxy-revalidate Content-Length: 0 Content-Type: text/html Date: Sat, 23 Sep 2017 02:13:07 GMT Etag: 1506-132787-817762 Last-Modified: Sat, 23 Sep 2017 02:13:07 GMT Location: http://10.40.24.76:8008/api/config/log-collector-exporter/exporter/rules/rule/Director-Forward Pragma: no-cache Server: