Create, modify, and delete metricstores in the Simple Log Service (SLS) console. To delete metrics manually, shorten the data retention period of a metricstore.
A metricstore collects, stores, and queries metrics in SLS. Each metricstore belongs to a project, which can contain multiple metricstores. For more information, see Metricstore.
Prerequisite
A project is created. For more information, see Manage projects.
Create a metricstore
Log on to the Simple Log Service console.
In the Projects section, click the one you want.

-
On the tab, click the + icon.
-
In the Create Metricstore panel, configure the following parameters and click OK.
Parameter
Description
Metricstore Name
The metricstore name. Must be unique within the project. Cannot be changed after creation.
Data Retention Period
How long metrics are retained in the metricstore.
-
Specified Days: Retains metrics for 1 to 3000 days.
Warning-
Expired metrics are automatically deleted.
-
If you shorten the retention period, SLS deletes expired metrics within 1 hour. The Usage Details on the SLS console homepage updates the next day. For example, changing the retention period from 5 to 1 day deletes the previous four days of metrics within 1 hour.
-
-
Permanent Storage: Retains metrics indefinitely.
NoteA retention period of 3650 returned by the SDK indicates permanent storage.
Shards
The number of shards. Each shard supports 5 MB/s and 500 writes/s for writing, and 10 MB/s and 100 reads/s for reading. Maximum: 10 shards per metricstore, 200 per project. For more information, see Shard.
Automatic Sharding
If you turn on Automatic Sharding, SLS increases shards when write capacity is insufficient. For more information, see Manage shards.
Maximum Shards
Required when Automatic Sharding is enabled. Maximum number of read/write shards. Maximum value: 256.
-
Modify a metricstore
-
On the tab, hover over the target metricstore and choose .
-
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: Maximum number of read/write shards for automatic splitting. Maximum: 256.
-
Log Public IP: When you enable Log Public IP, SLS adds the following fields to each 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, as a UNIX timestamp (seconds since January 1, 1970, 00:00:00 UTC).
-
-
-
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 engine does not cache results and runs single-coroutine calculations on a single node, which leads to poor performance with many timelines, long query time ranges, or complex queries. SLS introduces Global Caching and Concurrent Computing to improve PromQL performance. For more information about the low-level design and configuration, see Query acceleration.
-
Write Settings
Metricstore stores metric data chronologically. Out-of-order writes (such as writing months-old data or data with incorrect timestamps due to clock drift) can severely degrade query performance.
Configure left and right time windows (in seconds) to filter data with abnormal timestamps. The valid range is [arrival time − left interval, arrival time + right interval]. Data outside this range is discarded. Setting [0,0] disables the filter.
NoteThis feature applies only to data written via 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
Processes data before writing, supporting field modification, parsing, filtering, and masking. For more information, see Process data during ingestion (ingest processor).
-
Tag
Add tags to a metricstore to group and manage your metricstores.
-
-
Click Save.
Delete a metricstore
-
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, stop writing new data and wait for all data to be shipped before deleting the metricstore.
-
Billing stops the day after deletion. The final bill for the last day of usage appears on your next daily statement.
-
Deleting a MetricStore also deletes all associated tasks, such as export tasks, data transformation tasks, scheduled SQL tasks that use the MetricStore as a data source, and import tasks that use it as a destination.
Before you delete a MetricStore, go to to view all tasks in the current Project and delete the tasks associated with the MetricStore.
-
On the tab, move the pointer over the metricstore that you want to delete and choose .
WarningDeleting a metricstore permanently removes all its metrics. This action cannot be undone.
-
In the message that appears, click OK.
Delete metrics
To manually delete metrics, shorten the Data Retention Period for the metricstore.
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.
> Modify