OpenStack Log API V1 (CURRENT)

API Versions

GET
/

List api versions

Lists information of Venus API versions.

Response codes

Success

Code

Reason

1 - Unknown

Request was successful.

Error

Code

Reason

-1 - Unknown

Some content in the request was invalid.

Response

Example List Api Versions: JSON response

{
    "v1.0": {
        "id": "v1.0",
        "status": "SUPPORTED",
        "updated": "2023-02-28T18:43:00Z",
        "links": [
            {
                "rel": "describedby",
                "type": "text/html",
                "href": "https://docs.openstack.org/"
            }
        ],
        "media-types": [
            {
                "base": "application/xml",
                "type": "application/vnd.openstack.venus+xml;version=1"
            },
            {
                "base": "application/json",
                "type": "application/vnd.openstack.venus+json;version=1"
            }
        ]
    }
}

Custom Config

Users can customize some important configurations, such as the retention days of ElasticSearch index.

GET
/v1/custom_config

Get custom config

Get all custom config.

Response codes

Success

Code

Reason

1 - Unknown

Request was successful.

Error

Code

Reason

-1 - Unknown

Some content in the request was invalid.

Response

Example: JSON response

{
    "log_save_days": "30",
    "anomaly_record_save_days": "30",
    "log_max_gb": "100"
}
POST
/v1/custom_config

Set custom config

Set one custom config.

Request

Name

In

Type

Description

id

body

string

custom config id

value

body

string

custom config value

Response codes

Success

Code

Reason

1 - Unknown

Request was successful.

Error

Code

Reason

-1 - Unknown

Some content in the request was invalid.

Response

Example: JSON response

{
    "code": 0,
    "msg": "OK"
}

Search API

Users can search, download and analyze logs, instance callchain.

GET
/v1/search/params

Get search params

Get the value list of search parameter, such as host list, module list.

Response codes

Success

Code

Reason

0 - Unknown

Request was successful, but no data caused by some reasons.

Error

Code

Reason

-1 - Unknown

Some content in the request was invalid.

Request

Name

In

Type

Description

type

query

string

the type of parameter, such as host_name, level, program_name, module_name

module_name (Optional)

query

string

the module name.

index_type (Optional)

query

string

the type of elasticsearch index, flog(default):Openstack log, slog:host OS log

Response

Example: JSON response

{
    "msg": "OK",
    "code": 1,
    "values":[
        "openstack.ceilometer",
        "openstack.keystone",
        "openstack.neutron"
    ]
}
GET
/v1/search/logs

Search logs

Search logs by host name, modules name, level, etc.

Request

Name

In

Type

Description

host_name (Optional)

query

string

host name

module_name (Optional)

query

string

the module name.

program_name (Optional)

query

string

the program name.

level (Optional)

query

string

the level of log, such as error, info.

user_id (Optional)

query

string

the user id.

project_id (Optional)

query

string

the project id.

query (Optional)

query

string

the search query for elasticsearch.

start_time (Optional)

query

int

the start timestamp of time frame.

end_time (Optional)

query

int

the end timestamp of time frame.

page_num (Optional)

query

int

the page num, first and default is 1.

page_size (Optional)

query

int

the size of page, default is 10.

index_type (Optional)

query

string

the type of elasticsearch index, flog(default):Openstack log, slog:host OS log

Response codes

Success

Code

Reason

1 - Unknown

Request was successful.

Error

Code

Reason

0 - Unknown

Request was successful, but no data caused by some reasons.

-1 - Unknown

Some content in the request was invalid.

Response

Example: JSON response

{
    "msg": "OK",
    "code": 1,
    "data":{
        "total": 4510027,
        "values": [
            {
                "user_id": "8a89984958192849ac1829400182e2410000",
                "level": "info",
                "host_name": [
                    "@skyline-highlighted-field@node31@/skyline-highlighted-field@"
                ],
                "time": "2022-09-10T12:33:35+08:00",
                "module_name": "openstack.keystone",
                "program_name": "keystone-apache-admin-access",
                "project_id": "7e02058126cc4950b75f9970368ba177",
                "desc": "100.2.80.232 - - [27/Sep/2019:12:33:35 +0800] \"HEAD /v3/auth/tokens HTTP/1.1\" 200 - 142459 \"-\" \"OpenStack4j / OpenStack Client\""
            }
        ]
    },
    "data_stats": {
        "count": [
            {
                "key_as_string": "2019-09-26T12:30:00.000+08:00",
                "key": 1569472200000,
                "doc_count": 60479
            },
            {
                "key_as_string": "2019-09-27T12:30:00.000+08:00",
                "key": 1569558600000,
                "doc_count": 9171
            }
        ],
        "interval_en": "30minutes",
        "interval_cn": "30\u5206\u949f"
    }
}
GET
/v1/search/logs/download

Download logs

Download the logs searched.

Response codes

Success

Code

Reason

1 - Unknown

Request was successful.

Error

Code

Reason

0 - Unknown

Request was successful, but no data caused by some reasons.

-1 - Unknown

Some content in the request was invalid.

Request

Name

In

Type

Description

host_name (Optional)

query

string

host name

module_name (Optional)

query

string

the module name.

program_name (Optional)

query

string

the program name.

level (Optional)

query

string

the level of log, such as error, info.

user_id (Optional)

query

string

the user id.

project_id (Optional)

query

string

the project id.

query (Optional)

query

string

the search query for elasticsearch.

start_time (Optional)

query

int

the start timestamp of time frame.

page_size (Optional)

query

int

the size of page, default is 10.

index_type (Optional)

query

string

the type of elasticsearch index, flog(default):Openstack log, slog:host OS log

Response

Example: JSON response

{
    "msg": "OK",
    "code": 1,
    "data": "BASE64XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxx"
}
GET
v1/search/analyse/logs

Analyse logs

Analyse logs of by host_name, module_name, program_name, level, etc.

Response codes

Success

Code

Reason

1 - Unknown

Request was successful.

Error

Code

Reason

0 - Unknown

Request was successful, but no data caused by some reasons.

-1 - Unknown

Some content in the request was invalid.

Request

Name

In

Type

Description

group_name

query

string

group name

host_name (Optional)

query

string

host name

module_name (Optional)

query

string

the module name.

program_name (Optional)

query

string

the program name.

level (Optional)

query

string

the level of log, such as error, info.

start_time (Optional)

query

int

the start timestamp of time frame.

end_time (Optional)

query

int

the end timestamp of time frame.

Response

Example: JSON response

{
    "msg": "OK",
    "code": 1,
    "data":{
        "count": [
            {
                "key": "node31",
                "doc_count": 4510027
            },
            {
                "key": "node32",
                "doc_count": 1865824
            },
            {
                "key": "node34",
                "doc_count": 954416
            }
        ],
        "title_en": "Program Log Analysis Histogram",
        "title_cn": "\u7ec4\u4ef6\u65e5\u5fd7\u5206\u6790\u67f1\u72b6\u56fe"
    }
}
GET
v1/search/typical/logs

Search typical error logs of all modules

Search typical error log, such as error logs of all modules, RabbitMQ related error logs, MariaDB related error logs.

Response codes

Success

Code

Reason

1 - Unknown

Request was successful.

Error

Code

Reason

0 - Unknown

Request was successful, but no data caused by some reasons.

-1 - Unknown

Some content in the request was invalid.

Request

Name

In

Type

Description

type

query

string

the typical log type, such as error_stats, rabbitmq_error_stats, mysql_error_stats

start_time (Optional)

query

int

the start timestamp of time frame.

end_time (Optional)

query

int

the end timestamp of time frame.

Response

Example: JSON response

{
    "msg": "OK",
    "code": 1,
    "data": {
        "interval_en": "30minutes",
        "interval_cn": "30\u5206\u949f",
        "stats": [
            {
                "count": [
                    {
                        "key_as_string": "2019-11-07T14:00:00.000+08:00",
                        "key": 1573106400000,
                        "doc_count": 3213
                    }
                ],
                "total": 78870,
                "key": "nova-api"
            }
        ]
    }
}
GET
v1/search/instance/request_ids

Search the list of instance request id

Get instance request id list.

Response codes

Success

Code

Reason

1 - Unknown

Request was successful.

Error

Code

Reason

0 - Unknown

Request was successful, but no data caused by some reasons.

-1 - Unknown

Some content in the request was invalid.

Request

Name

In

Type

Description

start_time (Optional)

query

int

the start timestamp of time frame.

end_time (Optional)

query

int

the end timestamp of time frame.

Response

Example: JSON response

{
    "msg": "OK",
    "code": 1,
    "request_ids": [
        "4025e53e-1c26-432a-85fc-39638010efc4"
    ]
}
GET
/v1/search/instance/callchain

Search instance callchain(Only create operation)

Search instance callchain, export the logs of nova-api, nova-conductor, nova-scheduler and nova-compute.

Response codes

Success

Code

Reason

1 - Unknown

Request was successful.

Error

Code

Reason

0 - Unknown

Request was successful, but no data caused by some reasons.

-1 - Unknown

Some content in the request was invalid.

Request

Name

In

Type

Description

request_id

query

string

request id.

uuid

query

string

uuid.

Response

Example: JSON response

{
    "msg": "OK",
    "code": 1,
    "data": {
        "nova-conductor": [
            {
                "log_num": 3,
                "error_log_num": 0,
                "start_time": "2019-11-08T09:24:43+08:00",
                "hostname": "node32",
                "end_time": "2019-11-08T09:24:47+08:00"
            }
        ],
        "nova-api": [
            {
                "log_num": 1,
                "error_log_num": 0,
                "start_time": "2019-11-08T09:24:42+08:00",
                "hostname": "node31",
                "end_time": "2019-11-08T09:24:42+08:00"
            }
        ],
        "nova-scheduler": [
            {
                "log_num": 3,
                "error_log_num": 0,
                "start_time": "2019-11-08T09:24:45+08:00",
                "hostname": "node31",
                "end_time": "2019-11-08T09:24:43+08:00"
            }
        ],
        "nova-compute": [
            {
                "is_success": 0,
                "start_time": "2019-11-08T09:24:48+08:00",
                "hostname": "node31",
                "end_time": "2019-11-08T09:25:04+08:00"
            }
        ]
    }
}

Anomaly Detect

Users can add, delete, modify and query anomaly rules, query and delete anomaly records.

POST
/v1/anomaly/rule

Add anomaly rule

Add an anomaly rule.

Request

Name

In

Type

Description

title

body

string

the title of anomaly rule.

desc

body

string

the description of anomaly rule.

keyword

body

string

keyword, only support exact-match at present.

log_type

body

string

the type of log, flog is platform log, and slog is operate system log.

module

body

string

application module or service.

Example Add Anomaly rule request:

curl -X POST "http://127.0.0.1:10010/v1/anomaly/rule" \
  -d '{"title": "test", "desc":"test", "keyword": "out of memory", "log_type":"flog", "module":"nova"}' 
  -H 'X-Auth-Token: 124' 
  -H 'Content-type: application/json'

Response codes

Success

Code

Reason

0 - Unknown

Request was successful, but no data caused by some reasons.

Error

Code

Reason

-1 - Unknown

Some content in the request was invalid.

Response

Example Add An Anomaly Rule response:

{
    "code": 0,
    "msg": "OK"
}
GET
/v1/anomaly/rule/{id}

Get anomaly rule

Get information of an anomaly rule.

Request

Name

In

Type

Description

id

query

string

The id of an anomaly rule.

Response codes

Success

Code

Reason

1 - Unknown

Request was successful.

Error

Code

Reason

-1 - Unknown

Some content in the request was invalid.

Response

Example Get An Anomaly Rule response:

{
    "code": 0,
    "msg": "OK",
    "rule": {
        "id": "152f637bbd5646ab8e69313512514c4c",
        "title": "\u6d4b\u8bd5\u89c4\u5219",
        "desc": "\u8fd9\u662f\u4e00\u4e2a\u6d4b\u8bd5\u89c4\u5219",
        "keyword": "Running periodic task",
        "log_type": "flog",
        "module": "venus",
        "flag": 1,
        "create_time": "2023-08-01T03:24:24.000000",
        "update_time": "2023-08-01T03:24:24.000000"
    }
}
POST
/v1/anomaly/rule/{id}

Update anomaly rule

Update an anomaly rule.

Request

Name

In

Type

Description

id

query

string

The id of an anomaly rule.

title (Optional)

body

string

the title of anomaly rule.

desc (Optional)

body

string

the description of anomaly rule.

keyword (Optional)

body

string

keyword, only support exact-match at present.

log_type (Optional)

body

string

the type of log, flog is platform log, and slog is operate system log.

module (Optional)

body

string

application module or service.

flag (Optional)

body

string

whether enable flag, 0: disable, 1: enable.

Example Update An Anomaly Rule request:

{
  "title": "new name"
}

Response codes

Success

Code

Reason

1 - Unknown

Request was successful.

Error

Code

Reason

-1 - Unknown

Some content in the request was invalid.

Response

Example Update An Anomaly Rule Success response:

{
  "code": 0,
  "msg": "OK"
}

Example Update An Anomaly Rule Failed response:

{
  "code": -1,
  "msg": "no found"
}
GET
/v1/anomaly/rule/list

Get anomaly rule list

Get all anomaly rules.

Response codes

Success

Code

Reason

0 - Unknown

Request was successful, but no data caused by some reasons.

Error

Code

Reason

-1 - Unknown

Some content in the request was invalid.

Request

Name

In

Type

Description

title (Optional)

body

string

the title of anomaly rule.

desc (Optional)

body

string

the description of anomaly rule.

keyword (Optional)

body

string

keyword, only support exact-match at present.

log_type (Optional)

body

string

the type of log, flog is platform log, and slog is operate system log.

module (Optional)

body

string

application module or service.

flag (Optional)

body

string

whether enable flag, 0: disable, 1: enable.

page_num (Optional)

query

int

the page num, first and default is 1.

page_size (Optional)

query

int

the size of page, default is 10.

Response

Example: JSON response

{
    "code": 0,
    "msg": "OK",
    "rules": [
        {
            "id": "152f637bbd5646ab8e69313512514c4c",
            "title": "new name",
            "desc": "\u8fd9\u662f\u4e00\u4e2a\u6d4b\u8bd5\u89c4\u5219",
            "keyword": "Running periodic task",
            "log_type": "flog",
            "module": "venus",
            "flag": 1,
            "create_time": "2023-08-01T03:24:24.000000",
            "update_time": "2023-08-01T09:22:54.000000"
        },
        {
            "id": "378c888fd4d946f6a6e2f4e2d4100ff4",
            "title": "\u6d4b\u8bd5\u89c4\u5219",
            "desc": "\u8fd9\u662f\u4e00\u4e2a\u6d4b\u8bd5\u89c4\u5219",
            "keyword": "out of memory",
            "log_type": "flog",
            "module": "nova",
            "flag": 1,
            "create_time": "2023-08-01T08:24:54.000000",
            "update_time": "2023-08-01T08:24:54.000000"
        }
    ]
}
DELETE
/v1/anomaly/rule/{id}

Delete anomaly rule

Delete anomaly rule.

Response codes

Success

Code

Reason

1 - Unknown

Request was successful.

Error

Code

Reason

-1 - Unknown

Some content in the request was invalid.

Request

Name

In

Type

Description

id

query

string

The id of an anomaly rule.

Response

Example: JSON response

{
    "code": 0,
    "msg": "OK"
}
GET
/v1/anomaly/record/list

Get anomaly record

Get all anomaly records.

Request

Name

In

Type

Description

title (Optional)

body

string

the title of anomaly record.

log_type (Optional)

body

string

the log type of anomaly log, such as flog, slog

module (Optional)

query

string

the module name.

start_time (Optional)

query

int

the start timestamp of time frame.

end_time (Optional)

query

int

the end timestamp of time frame.

page_num (Optional)

query

int

the page num, first and default is 1.

page_size (Optional)

query

int

the size of page, default is 10.

Example Get Anomaly record request:

curl -X GET http://127.0.0.1:10010/v1/anomaly/record/list \
  -H 'X-Auth-Token: 124' 
  -H 'Content-type: application/json'

Response codes

Success

Code

Reason

0 - Unknown

Request was successful, but no data caused by some reasons.

Error

Code

Reason

-1 - Unknown

Some content in the request was invalid.

Response

Example: JSON response

{
    "code": 0,
    "msg": "OK",
    "records": [
        {
            "id": "00b32723a3c240afab037593c8b11692",
            "title": "\u6d4b\u8bd5\u89c4\u5219",
            "desc": "\u8fd9\u662f\u4e00\u4e2a\u6d4b\u8bd5\u89c4\u5219",
            "keyword": "Running periodic task",
            "log_type": "flog",
            "module": "venus",
            "logs": "[] Running periodic task Manager.test_periodictask0 run_periodic_tasks /usr/local/lib/python3.8/dist-packages/oslo_service/periodic_task.py:210",
            "start_time": "2023-08-01T07:54:01.000000",
            "end_time": "2023-08-01T07:54:01.000000",
            "create_time": "2023-08-01T07:54:01.000000"
        },
        {
            "id": "00b890b214e84ee89a98bc1b53807f88",
            "title": "\u6d4b\u8bd5\u89c4\u5219",
            "desc": "\u8fd9\u662f\u4e00\u4e2a\u6d4b\u8bd5\u89c4\u5219",
            "keyword": "Running periodic task",
            "log_type": "flog",
            "module": "venus",
            "logs": "[] Running periodic task Manager.test_periodictask0 run_periodic_tasks /usr/local/lib/python3.8/dist-packages/oslo_service/periodic_task.py:210",
            "start_time": "2023-08-01T07:53:57.000000",
            "end_time": "2023-08-01T07:53:57.000000",
            "create_time": "2023-08-01T07:53:57.000000"
        }
    ]
}
DELETE
/v1/anomaly/record/{id}

Delete anomaly record

Delete anomaly record.

Request

Name

In

Type

Description

id

query

string

anomaly record id

Example Get Anomaly record request:

curl -X DELETE "http://127.0.0.1:10010/v1/anomaly/record/1" \
  -H 'X-Auth-Token: 124' 
  -H 'Content-type: application/json'

Response codes

Success

Code

Reason

0 - Unknown

Request was successful, but no data caused by some reasons.

Error

Code

Reason

-1 - Unknown

Some content in the request was invalid.

Response

Example: JSON response

{
    "code": 0,
    "msg": "OK"
}