Collection policy creation and management endpoints in the REST API


Create and manage collection policies that are used to collect the logs.

POST/policies
Create a collection policy
Request URL
/logs-service/api/v1.0/logs/policies
Example request URL
https://HostA.bmc.com/logs-service/api/v1.0/logs/policies
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>


Example request body

 {
   "name": "Collection Policy",
   "description": "Dummy description",
   "selection_criteria": "( name EQUALS 'host_name' )",
   "tenant_id": "1111111111",
   "configurations": [
       {
           "name": "Collection Config",
           "type": "COLLECTION",
           "display_order": 1,
           "details": {
               "integration_template_id": "8dec2e2c-ae1b-4272-81bc-3d07b0a9d4d6",
               "hosted": false,
               "collection_type": "FILE",
               "connector_type": "tdc-connector-base",
               "parsing_rules": [
                   {
                       "name": "Parsing rule name",
                       "id": "00d46564-9081-4e6c-8674-f2a884d28141"
                   }
                ],
               "filtering_rules": [
                   {
                       "name": "Filtering rule name",
                       "id": "01b6678e-45f7-45c9-9ce8-c095cf3ca485"
                   }
                ],
               "selected_entities": [
                   "Log"
                ],
               "parameters": [
                   {
                       "name": "path",
                       "secret": false,
                       "dataType": "String",
                       "context": {},
                       "value": "/test/log"
                   },
                   {
                       "name": "exclude_path",
                       "secret": false,
                       "dataType": "string_array",
                       "context": {},
                       "array_value": [
                           ""
                        ]
                   },
                   {
                       "name": "tag",
                       "secret": false,
                       "dataType": "String",
                       "context": {},
                       "value": "apache_server_NY"
                   }
                ]
           }
       }
    ],
   "enabled": true,
   "execution_order": 1
}


Response codes

Code

Description

201

Collection policy is created successfully. Returns the collection policy ID in the payload.

400

Error for invalid data. Check if all input values are valid. 

401

Authorization failure. Verify JWT.

403

Permission denied. Verify the roles assigned to you.

415

Incorrect request format. Ensure that the request format is JSON.

500

Unexpected condition encountered. Contact BMC Support.

Back to top

PUT/policies/{id}
Update a collection policy by ID
Request URL
/logs-service/api/v1.0/logs/policies/{id}
Example request URL
https://HostA.bmc.com/logs-service/api/v1.0/logs/policies/a00a0a00-a000-00a0-a000-0a000aa0a0a0
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>


Parameter details



Example request body

 {
   "name": "Collection Policy",
   "description": "Dummy description",
   "selection_criteria": "( name EQUALS 'host_name' )",
   "tenant_id": "1111111111",
   "configurations": [
       {
           "name": "Collection Config",
           "type": "COLLECTION",
           "display_order": 1,
           "details": {
               "integration_template_id": "8dec2e2c-ae1b-4272-81bc-3d07b0a9d4d6",
               "hosted": false,
               "collection_type": "FILE",
               "connector_type": "tdc-connector-base",
               "parsing_rules": [
                   {
                       "name": "Parsing rule name",
                       "id": "00d46564-9081-4e6c-8674-f2a884d28141"
                   }
                ],
               "filtering_rules": [
                   {
                       "name": "Filtering rule name",
                       "id": "01b6678e-45f7-45c9-9ce8-c095cf3ca485"
                   }
                ],
               "selected_entities": [
                   "Log"
                ],
               "parameters": [
                   {
                       "name": "path",
                       "secret": false,
                       "dataType": "String",
                       "context": {},
                       "value": "/test/log"
                   },
                   {
                       "name": "exclude_path",
                       "secret": false,
                       "dataType": "string_array",
                       "context": {},
                       "array_value": [
                           ""
                        ]
                   },
                   {
                       "name": "tag",
                       "secret": false,
                       "dataType": "String",
                       "context": {},
                       "value": "apache_server_NY"
                   }
                ]
           }
       }
    ],
   "enabled": true,
   "execution_order": 1
}

Response codes

Code

Description

200

Collection policy is updated successfully.

400

Error for invalid data. Check if all input values are valid. 

401

Authorization failure. Verify JWT.

403

Permission denied. Verify the roles assigned to you.

404

The collection policy ID is not found.

415

Incorrect request format. Ensure that the request format is JSON and collection policy ID is correct.

500

Unexpected condition encountered. Contact BMC Support.

Back to top

GET/policies/{id}
Get a collection policy by ID
Request URL
/logs-service/api/v1.0/logs/policies/{ID}
Example request URL
https://HostA.bmc.com/logs-service/api/v1.0/logs/policies/a00a0a00-a000-00a0-a000-0a000aa0a0a0/upload
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>


Parameter details



Response codes

Code

Description

200

Collection policy returned successfully.

401

Authorization failure. Verify JWT.

403

Permission denied. Verify the roles assigned to you.

404

The collection policy ID is not found.

500

Unexpected condition encountered. Contact BMC Support.

Back to top

POST/policies/search
Search collection policies
Request URL
/logs-service/api/v1.0/logs/policies/search
Example request URL
https://HostA.bmc.com/logs-service/api/v1.0/logs/policies/search
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>


Example request body

{
"page_index": 1,
"page_size": 100,
"search_string": "name = 'Collection_Policy' and enabled = true",
"sort_criteria": "name DESC, enabled ASC"
}


Response codes

Code

Description

200

Policies are found. Returns details of the policies in the payload.

400

Error for invalid data. Check if all input values are valid. 

401

Authorization failure. Verify JWT.

403

Permission denied. Verify the roles assined to you.

415

Incorrect request format. Ensure that the request format is JSON and collection policy IDs are correct.

500

Unexpected condition encountered. Contact BMC Support.

Back to top

POST/policies/enable
Enable collection policies
Request URL
/logs-service/api/v1.0/logs/policies/enable
Example request URL
https://HostA.bmc.com/logs-service/api/v1.0/logs/policies/enable
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>


Example request body

{
 "ids": [
   "a00a0a00-a000-00a0-a000-0a000aa0a0a0"
  ]
}


Response codes

Code

Description

200

Collection policies are enabled successfully.

207

Some collection policies are enabled. IDs of the policies that are not enabled are returned.

400

Error for invalid data. Check if all input values are valid. 

401

Authorization failure. Verify JWT.

403

Permission denied. Verify the roles assigned to you.

415

Incorrect request format. Ensure that the request format is JSON and collection policy IDs are correct.

500

Unexpected condition encountered. Contact BMC Support.

Back to top

POST/policies/disable
Disable collection policies
Request URL
/logs-service/api/v1.0/logs/policies/disable
Example request URL
https://HostA.bmc.com/logs-service/api/v1.0/logs/policies/disable
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>


Example request body

{
 "ids": [
   "a00a0a00-a000-00a0-a000-0a000aa0a0a0"
  ]
}


Response codes

Code

Description

200

Collection policies are disabled successfully. 

207

Some collection policies are disabled. IDs of the policies that are not disabled are returned.

400

Error for invalid data. Check if all input values are valid. 

401

Authorization failure. Verify JWT.

403

Permission denied. Verify the roles assigned to you.

415

Incorrect request format. Ensure that the request format is JSON and collection policy IDs are correct.

500

Unexpected condition encountered. Contact BMC Support.

Back to top

DELETE/policies
Delete collection policies
Request URL
 /logs-service/api/v1.0/logs/policies
Example request URL
 https://HostA.bmc.com/logs-service/api/v1.0/logs/policies
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API..

Example request body

{
 "id": [
   "a00a0a00-a000-00a0-a000-0a000aa0a0a0"
  ]
}

Response codes

Code

Description

200

Collection policies are deleted successfully.

207

Some collection policies are deleted. IDs of the policies that are not deleted are returned.

400

Error for invalid data. Check if all input values are valid. 

401

Authorization failure. Verify JWT.

403

Permission denied. Verify the roles assigned to you.

415

Incorrect request format. Ensure that the request format is JSON and collection policies IDs are correct.

500

Unexpected condition encountered. Contact BMC Support.

Back to top

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC Helix Log Analytics 23.3