Updated on 2024-05-27 GMT+08:00

Log Streams

A log stream is the basic unit for reading and writing logs. You can separate different types of logs (such as operation logs and access logs) into different log streams for easier management. Sorting logs into different log streams makes it easier to find specific logs when you need them.

Up to 100 log streams can be created in a log group. The upper limit cannot be increased. If you cannot create a log stream because the upper limit is reached, you are advised to delete log streams that are no longer needed and try again, or create log streams in a new log group.

Prerequisites

You have created a log group.

Creating a Log Stream

  1. On the LTS console, click on the left of a log group name.
  2. In the dialog box displayed, set log stream parameters by referring to Table 1.
    Table 1 Log stream parameters

    Parameter

    Description

    Log Group Name

    The name of the target log group is displayed by default.

    Log Stream Name

    • A log stream name can contain 1 to 64 characters, including only letters, digits, hyphens (-), underscores (_), and periods (.). It cannot start with a period or underscore or end with a period.
    • Collected logs are sent to the created log stream. If there are a large number of logs, you can create multiple log streams and name them for quick log search.

    Enterprise Project Name

    Select the required enterprise project. The default value is default. You can click View Enterprise Projects to view all enterprise projects.

    Log Storage

    If enabled, logs will be stored in the search engine and all log functions are available.

    If disabled, logs are not flushed to disks. This saves on index traffic and storage costs, but disables log search, analysis, alarm, consumption, and processing. You will only be able to use metric generation and log transfer functions.
    NOTE:

    If this function is disabled, Log Retention Duration cannot be enabled.

    Log Retention Duration

    Log retention duration for the log stream.

    • If this parameter is disabled, the log stream will inherit the log retention setting of the log group.
    • If this parameter is enabled, you can set the log retention duration specifically for the log stream.

    Anonymous Write

    Anonymous write is disabled by default and applies to log reporting on Android, iOS, applets, and browsers. If anonymous write is enabled, the anonymous write permission is granted to the log stream, and no valid authentication is performed, which may generate dirty data.

    Tag

    Add tags for different log streams as required. Click Add Tags and enter a tag key and tag value.

    NOTE:
    • To add multiple tags, repeat this step.
    • To delete a tag, click in the Operation column of the tag.
    • A tag key can contain up to 128 characters, and a tag value can contain up to 255 characters.
    • A tag key must be unique.
    • If a tag is used by a transfer task, you need to modify the task configuration after deleting the tag.

    Remark

    Enter remarks. The value contains up to 1,024 characters.

  3. Click OK. In the log stream list, you can view information such as the log stream name and operations.
    • You can view the log stream billing status. For details, see Price Calculator.
    • The function of reporting SDRs by log stream is in Friendly User Test (FUT). You can submit a service ticket to enable it.

Modifying a Log Stream

By default, a log stream inherits the log retention setting from the log group it belongs to.

  1. In the log stream list, locate the target log stream and click in the Operation column.
  2. In the dialog box displayed, modify the log stream name and log retention duration.
    Figure 1 Modifying a log stream
    • If you disable Log Retention Duration, the log stream will inherit the log retention setting of the log group.
    • If you enable Log Retention Duration, you can set the log retention duration specifically for the log stream.
    • The logs that exceed the retention period will be deleted automatically. You can transfer logs to OBS buckets for long-term storage.
    • Currently, logs of whitelisted users can be retained for 1,095 days. If necessary, submit a service ticket.
    • For details about how to add a tag, see Tag Management.
  3. Click OK.
  4. After the modification is successful, move the cursor over the log stream name. The new and original log stream names are displayed.
    Figure 2 Log stream name

Deleting a Log Stream

You can delete a log stream that is no longer needed. Deleting a log stream will also delete the log data in the log stream. Deleted log streams cannot be recovered. Exercise caution when performing the deletion.

  • Before deleting a log stream, check whether any log collection task is configured for it. If there is a log collection task, deleting the log stream may affect log reporting.
  • If you want to delete a log stream that is associated with a log transfer task, delete the task first.
  1. In the log stream list, locate the target log stream and click in the Operation column.
  2. Enter DELETE and click OK.
    Figure 3 Deleting a log stream

Other Operations

  • Adding a log stream to favorites

    Click in the Operation column of a log stream to add the log stream to favorites. The log stream is then displayed in My Favorites/My Favorites (Local Cache) on the console home page.

  • Details

    Click in the Operation column of a log stream to view its details, including the log stream name, log stream ID, and creation time.