Filtering rule creation and management endpoints in the REST API


Create and manage filtering rules that are used to filter the logs for collection.

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


Example request body

{
   "id": "",
   "name": "Filter rule",
   "description": "Dummy filter rule",
   "params": [
       {
           "name": "filter",
           "secret": false,
           "dataType": "enum",
           "context": {
               "isFilterTypeIndicator": "true"
           },
           "value": "grep"
       },
       {
           "name": "grep_filter_config",
           "secret": false,
           "dataType": "composite_parameter",
           "context": {
               "composite_parameter_convert_class": "Grep_filter_composite_param_converter"
           },
           "parameter_value": [
                [
                   {
                       "name": "directive",
                       "secret": false,
                       "dataType": "enum",
                       "context": {
                           "grep_filter_directive": "true"
                       },
                       "value": "regexp"
                   },
                   {
                       "name": "key",
                       "secret": false,
                       "dataType": "String",
                       "context": {
                           "grep_filter_params": "true"
                       },
                       "value": "name"
                   },
                   {
                       "name": "pattern",
                       "secret": false,
                       "dataType": "String",
                       "context": {
                           "grep_filter_params": "true"
                       },
                       "value": "a*"
                   }
                ]
            ]
       }
    ],
   "integration_template_id": "da51ea5a-f396-40c7-afc4-206b833746eb",
   "collection_type": "FILE",
   "rule_type": "FILTER"
}


Response codes

Code

Description

200

Filtering rule is created successfully. Returns the rule 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/rules/{id}
Update a filtering rule by ID
Request URL
/logs-service/api/v1.0/collection/rules/{id}
Example request URL
https://HostA.bmc.com/logs-service/api/v1.0/collection/rules/a00a0a00-a000-00a0-a000-0a000aa0a0a0
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>


Parameter details



Example request body

{
   "id": "67f0b97c-5420-4313-8cf0-0d2677553e9f",
   "name": "Filter rule",
   "description": "Dummy filter rule",
   "tenant_id": "111111100",
   "rule_type": "FILTER",
   "params": [
       {
           "name": "filter",
           "secret": false,
           "dataType": "enum",
           "context": {
               "isFilterTypeIndicator": "true"
           },
           "value": "grep"
       },
       {
           "name": "grep_filter_config",
           "secret": false,
           "dataType": "composite_parameter",
           "context": {
               "composite_parameter_convert_class": "Grep_filter_composite_param_converter"
           },
           "parameter_value": [
                [
                   {
                       "name": "directive",
                       "secret": false,
                       "dataType": "enum",
                       "context": {
                           "grep_filter_directive": "true"
                       },
                       "value": "regexp"
                   },
                   {
                       "name": "key",
                       "secret": false,
                       "dataType": "String",
                       "context": {
                           "grep_filter_params": "true"
                       },
                       "value": "name"
                   },
                   {
                       "name": "pattern",
                       "secret": false,
                       "dataType": "String",
                       "context": {
                           "grep_filter_params": "true"
                       },
                       "value": "a*"
                   }
                ]
            ]
       }
    ],
   "integration_template_id": "da51ea5a-f396-40c7-afc4-206b833746eb",
   "collection_type": "FILE",
   "updated_at": 1673251959376,
   "policy_count": 0
}

Response codes

Code

Description

200

Filtering rule 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 filtering rule ID is not found.

415

Incorrect request format. Ensure that the request format is JSON and filtering rule ID is correct.

500

Unexpected condition encountered. Contact BMC Support.

Back to top

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


Parameter details



Response codes

Code

Description

200

Filtering rule returned 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 filtering rule ID is not found.

500

Unexpected condition encountered. Contact BMC Support.

Back to top

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


Example request body

{
"page_index": 1,
"page_size": 2000,
"search_string": "rule_type = 'FILTER'",
"sort_criteria": "name ASC"
}


Response codes

Code

Description

200

Rules are found. Returns details of the filtering rule 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.

500

Unexpected condition encountered. Contact BMC Support.

Back to top

DELETE/rules
Delete filtering rules
Request URL
/logs-service/api/v1.0/collection/rules
Example request URL
https://HostA.bmc.com/logs-service/api/v1.0/collection/rules
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

Filtering rules are deleted 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

Filtering rule is not found.

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*