Log Tank Service (LTS)

Log Tank Service (LTS) enables you to collect logs from hosts and cloud services for centralized management, and analyze large volumes of logs efficiently, securely, and in real time. LTS provides you with the insights for optimizing the availability and performance of cloud services and applications. It allows you to make faster data-driven decisions, perform device O&M with ease, and analyze service trends.

LTS Group

A log group is the basic unit for LTS to manage logs. You can query and transfer logs in log groups. Up to 100 log groups can be created in your account.

Groups

This interface is used to get a list of groups. Group.

import openstack
from otcextensions import sdk

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)

for group in conn.lts.groups():
    print(group)

Create group

This interface is used to create new group. Group.

import openstack
from otcextensions import sdk

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)

attrs = {
    'log_group_name': 'testgroup',
    'ttl_in_days': 6
}
log_group = conn.lts.create_group(**attrs)

Update group

This interface is used to update group. Group.

import openstack
from otcextensions import sdk

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)

attrs = {
    'log_group_name': 'testgroup',
    'ttl_in_days': 5
}
log_group = conn.lts.update_group(group='log-group-uuid', **attrs)

Delete group

This interface is used to delete group. Group.

import openstack
from otcextensions import sdk

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)

log_group = conn.lts.delete_group(group='log-group-uuid')

LTS Stream

Up to 100 streams can be created in a log group.

You can separate logs into different log streams based on log types, and name log streams in an easily identifiable way. This helps you quickly find your desired logs.

Streams

This interface is used to get a list of streams in the group. Stream.

import openstack
from otcextensions import sdk

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)

for stream in conn.lts.streams(log_group='log-group-uuid'):
    print(stream)

Create stream

This interface is used to create a stream. Stream.

import openstack
from otcextensions import sdk

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)

attrs = {
    'log_group': 'log-group-uuid',
    'log_stream_name': 'log-stream-uuid',
    'ttl_in_days': 5
}
log_stream = conn.lts.create_stream(**attrs)

Delete stream

This interface is used to delete a stream. Stream.

import openstack
from otcextensions import sdk

openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
sdk.register_otc_extensions(conn)

log_stream = conn.lts.delete_stream(log_group='log-group-uuid',
                                    log_stream='log-stream-uuid')