Updated on 2023-11-29 GMT+08:00

Managing Log Streams

A log stream is the basic unit for reading and writing logs. 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

Log streams can be created in two ways. They are automatically created when other services are connected to LTS, or you can create one manually by following the steps described here.

Figure 1 Creating a log stream
  1. On the LTS console, click on the left of a log group name.
  2. Click Create Log Stream in the upper left corner of the displayed page, and enter a log stream name. After a log stream is created, its name cannot be changed. A log stream name:
    • Can contain only letters, digits, underscores (_), hyphens (-), and periods (.). The prefix cannot start with a period or underscore, or end with a period.
    • Can contain 1 to 64 characters.
    Figure 2 Creating a log stream

    Collected logs are sent to the created log stream. If there are too many logs to collect, you are advised to separate logs into different log streams based on log types, and name log streams in an easily identifiable way.

  3. Select an enterprise project. You can click View Enterprise Projects to view all enterprise projects.
  4. If you enable Log Retention Duration on this page, you can set the log retention duration specifically for the log stream. If you disable it, the log stream will inherit the log retention setting of the log group.
  5. Set the tag value in the Key = Value format, for example, a=b. For details, see Tag Management.
  6. Enter remarks. The value contains 0 to 1024 characters.
  7. Click OK. In the log stream list, you can view information such as the log stream name and operations.

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.
    • 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.
    • For details about how to add a tag, see Tag Management.
  3. Modify log stream remarks.
  4. Click OK.
  5. After the modification is successful, move the cursor over the log stream name. The new and original log stream names are displayed.

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.

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, log retention duration (days), creation type, and creation time.