Skip to content

Create



POST /api/v1/blacklist/add

Overview

Create a blacklist

Route Parameters

Parameter Name Type Required Description
name string Y Name (2024-11-27 iteration added)
Allow empty: False
Allow empty string: False
Max length: 50
desc string Y Description (2024-11-27 iteration added)
Example: Description 1
Allow empty: False
Allow empty string: True
Max length: 256
type string Y Blacklist type, enumeration value types are ('object', 'custom_object', 'logging', 'keyevent', 'tracing', 'rum', 'network', 'security', 'profiling', 'metric')
Allow empty: False
source string Y Data source, when all sources are selected, source is re(.*)
Allow empty: True
Allow empty string: False
$maxCharacterLength: 128
sources array Y Data sources, use this field for multiple sources, when not all sources are selected (use the source field re(.*) for all sources)
Allow empty: True
filters array Y Filter conditions
Allow empty: True

Parameter Supplementary Explanation


1.Request Body Field Description

Parameter Name Type Required Description
name string Y Name (2024-11-27 iteration added)
desc string N Description (2024-11-27 iteration added)
type string Y Enumeration value types('object', 'custom_object', 'logging', 'keyevent', 'tracing', 'rum', 'network', 'security', 'profiling', 'metric')
source string N Data source, all sources, source is re(.*)
sources array N Data sources, field added in the 2024-10-16 iteration, supports selection of multiple sources, can be used when the sources are not all sources, the sources field takes precedence over the source field
filter array N Filter conditions

2.source Field Description

When generating the filter conditions for the blacklist, the key for the parameter source field will be replaced according to the type.

Type The key corresponding to the source field when generating filter conditions
object class
logging source
custom_object class
keyevent source
tracing service
rum app_id
network source
security category
profiling service
metric measurement

3.filters Array Element Field Description

Parameter Name Type Required Description
name string N Filter condition name
operation string N Operation to perform, e.g., in, not_in, match, not_match
condition string N Filter condition in DQL format
values array N Specific values for the query condition

4. operation Description Refer to Line Protocol Filter

key Description
in The specified field is in the list
not_in The specified field is not in the list
match Regex match
not_match Regex does not match

**filters example is as follows filters:[ { "name":"host", "value":[ "host1", "host2" ], "operation":"in", "condition":"and" }, { "name":"status", "value":[ "a*" ], "operation":"match", "condition":"and" } ]

Request Example

curl 'https://openapi.guance.com/api/v1/blacklist/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"name":"Rule1","desc":"","type":"logging","source":"kodo-log","filters":[{"name":"host","value":["127.0.0.1"],"operation":"in","condition":"and"}]}' \
--compressed

Response

{
    "code": 200,
    "content": {
        "conditions": "{ source =  'kodo-log'  and ( host in [ '127.0.0.1' ] )}",
        "createAt": 1678029404,
        "creator": "xxxx",
        "deleteAt": -1,
        "desc": "",
        "filters": [
            {
                "condition": "and",
                "name": "host",
                "operation": "in",
                "value": [
                    "127.0.0.1"
                ]
            }
        ],
        "id": null,
        "name": "Rule1",
        "source": "kodo-log",
        "status": 0,
        "type": "logging",
        "updateAt": 1678029404,
        "updator": "xxxx",
        "uuid": "blist_xxxx32",
        "workspaceUUID": "wksp_xxxx32"
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-1C3DFE84-E7AD-4956-B363-8BB7EB3CD5A4"
} 

Feedback

Is this page helpful? ×