All Products
Search
Document Center

Simple Log Service:Manage a metricstore

Last Updated:Jan 12, 2026

This topic describes how to manage metricstores in the Simple Log Service (SLS) console, including creating, modifying, and deleting them. To delete metrics manually, shorten the data retention period of a metricstore.

A metricstore is used to collect, store, and query metrics in SLS. Each metricstore belongs to a project. Multiple metricstores can be created in a project. For more information, see Metricstore.

Prerequisite

A project is created. For more information, see Manage projects.

Create a metricstore

  1. Log on to the Simple Log Service console.

  2. In the Projects section, click the one you want.

    image

  3. On the Metric Storage > Metricstores tab, click the + icon.

  4. In the Create Metricstore panel, configure the following parameters and click OK.

    Parameter

    Description

    Metricstore Name

    The name of the metricstore. The name must be unique in the project to which the metricstore belongs. After the metricstore is created, its name cannot be changed.

    Data Retention Period

    The retention period of the collected metrics in the metricstore.

    • Specified Days Sets a specific retention period for your metrics. Valid values: 1 to 3000 days.

      Warning
      • After the retention period ends, metrics are automatically deleted.

      • If you shorten the data retention period, SLS deletes all expired metrics within 1 hour. The data volume that is displayed for Usage Details on the homepage of the SLS console is updated the next day. For example, if you change the data retention period from 5 days to 1 day, SLS deletes the metrics of the previous four days within 1 hour.

    • Permanent Storage: Retains metrics indefinitely.

      Note

      If you query the data retention period by calling an SDK and the returned result is 3650, metrics are permanently stored.

    Shards

    The number of shards. SLS provides shards that allow you to read and write data. Each shard supports a write capacity of 5 MB/s and 500 writes/s and a read capacity of 10 MB/s and 100 reads/s. Up to 10 shards can be created in each metricstore, and up to 200 shards can be created in each project. For more information, see Shard.

    Automatic Sharding

    If you turn on Automatic Sharding, SLS increases the number of shards when the existing shards cannot accommodate the data that is written. For more information, see Manage shards.

    Maximum Shards

    If you turn on Automatic Sharding, you must configure this parameter to specify the maximum number of readwrite shards that can be created. Maximum value: 256.

Modify a metricstore

  1. On the Metric Storage > Metricstores tab, hover over the target metricstore and choose 修改日志库 > Modify.

  2. On the Metricstore Attribute page, click Modify.

    • Basic Information

      • Data Retention Period: For a description of the parameters, see Create a metricstore.

      • Automatic Sharding: Enable this feature to automatically split shards and increase write throughput. For more information, see Manage shards.

      • Maximum Shards: The maximum number of shards into which a single metricstore can be split. A metricstore can be automatically split into a maximum of 256 shards that are in the readwrite state.

      • Log Public IP: When you enable the Log Public IP switch, SLS automatically adds the following fields to the log entry:

        • __client_ip__: The public IP address of the device where the log originates.

        • __receive_time__: The time when the log arrives at the server. This value is a UNIX timestamp that indicates the number of seconds that have elapsed since 00:00:00 UTC on January 1, 1970.

    • Shard Management

      When a metricstore is created, two shards are created by default. Split or merge shards later as needed. For more information, see Manage shards.

    • Query Acceleration Settings

      By default, the Prometheus Query compute engine does not cache execution results. Each query must read all data and re-run the calculation. The standard compute engine supports only single-coroutine calculations on a single node. This leads to poor performance in scenarios with many timelines, long query time ranges, or complex logic. To provide more efficient Prometheus Query Language (PromQL) calculations, the SLS timing compute engine introduces two enhancements: Global Caching and Concurrent Computing. For more information about the low-level design and configuration, see Query acceleration.

    • Write Settings

      Metricstore organizes and stores metric data in chronological order. If a large amount of dirty data is written out of order, query performance can be severely degraded. Examples include continuously writing data from months ago to a real-time Metricstore, or generating invalid data due to machine clock issues.

      Metricstore can filter monitoring data that has abnormal timestamps. On the write configuration page, configure left and right time windows, specified in seconds. The valid write time is relative to when the data arrives at the SLS service. The valid time range is [Data arrival time - Left interval, Data arrival time + Right interval]. Data outside this range is discarded. If the interval is [0,0], the time range rule is not applied.

      Note

      This feature applies only to data written using the Prometheus Remote Write protocol. For more information about connection types, see Collect metric data from Prometheus by using the Remote Write Protocol.

    • Ingest Processor

      The ingest processor lets you process data before it is written. This supports various scenarios, such as modifying fields, parsing fields, filtering data, and masking data. For more information, see Processing during ingestion (ingest processor).

    • Tag

      Add tags to a metricstore to group and manage your metricstores.

  3. Click Save.

Delete a metricstore

Important
  • Before deleting a metricstore, you must delete all Logtail configurations that are associated with the metricstore. For more information, see Delete a Logtail configuration.

  • If data shipping is enabled, ensure that you first stop writing new data and then wait for all existing data to be shipped before deleting the metricstore.

  • Billing for a deleted metricstore stops the day after deletion. The final bill for the last day of usage will appear on your next daily statement.

  1. On the Time Series Storage > Metricstore tab, move the pointer over the metricstore that you want to delete and choose 修改日志库 > Delete.

    Warning

    After you delete a metricstore, all metrics in the metricstore are deleted and cannot be restored. Proceed with caution.

  2. In the message that appears, click OK.

Delete metrics

To manually delete metrics, shorten the Data Retention Period for the metricstore.

Important

When you shorten the retention period, metrics that are now considered expired will be permanently deleted within one hour. For example, if you change the data retention period from 5 days to 1 day, SLS deletes the metrics of the previous four days within 1 hour.