Updates the configuration of a Logstore, including data retention, storage tiers, sharding, and tracking settings.
Prerequisites
Before you run this command, make sure you have:
Activated Simple Log Service (SLS)
Installed and configured the SLS CLI
Syntax
aliyunlog log update_logstore \
--project_name=<value> \
--logstore_name=<value> \
[--ttl=<value>] \
[--enable_tracking=<value>] \
[--shard_count=<value>] \
[--append_meta=<value>] \
[--auto_split=<value>] \
[--max_split_shard=<value>] \
[--preserve_storage=<value>] \
[--encrypt_conf=<value>] \
[--hot_ttl=<value>] \
[--mode=<value>] \
[--telemetry_type=<value>] \
[--infrequent_access_ttl=<value>]
For global parameters such as --access-id, --access-key, --region-endpoint, and --format-output, see Global parameters.
Parameters
|
Parameter |
Type |
Required |
Example |
Description |
|
|
String |
Yes |
|
The name of the project. Projects isolate resources and control access. For more information, see Manage projects. |
|
|
String |
Yes |
|
The name of the Logstore. Immutable after creation and must be unique within the project. Naming rules: lowercase letters, digits, hyphens ( |
|
|
Integer |
No |
|
Total data retention period in days. Valid values: 1 to 3650. Set to |
|
|
Integer |
No |
|
The number of shards. Accepted by the CLI but silently ignored. To adjust shard count, use SplitShard or MergeShard. For more information, see Shard range. |
|
|
Boolean |
No |
|
Enable ( |
|
|
Boolean |
No |
|
Record ( |
|
|
Boolean |
No |
|
Enable ( |
|
|
Integer |
No |
|
Maximum number of shards that automatic splitting can create. Valid values: 1 to 256. Required when |
|
|
String |
No |
-- |
Encryption configuration as a JSON string. For the data structure, see EncryptConf. |
|
|
String |
No |
|
The type of observable data stored in the Logstore. |
|
|
Integer |
No |
|
Retention period for the hot storage tier in days. Minimum: |
|
|
String |
No |
|
The Logstore type. |
|
|
Integer |
No |
|
Retention period for the IA tier in days. Data must remain in the IA tier for at least 30 days before moving to the Archive storage tier. For more information, see Configure intelligent tiered storage. |
When you lower the --ttl value, SLS deletes all newly expired data within 1 hour. For example, changing retention from 5 days to 1 day causes SLS to delete the previous 4 days of log data within 1 hour. The storage usage shown on the Usage Details page of the SLS console updates the next day.
The shard count cannot be modified through update_logstore. The CLI accepts the --shard_count parameter without error, but the value is silently ignored. To adjust the number of shards, use SplitShard or MergeShard.
Examples
Set the data retention period to 30 days and enable WebTracking for the logstore-a Logstore in the aliyun-test-project project:
aliyunlog log update_logstore \
--project_name="aliyun-test-project" \
--logstore_name="logstore-a" \
--ttl=30 \
--enable_tracking=true
A successful command returns no output. Run the following command to verify the update:
aliyunlog log get_logstore \
--project_name="aliyun-test-project" \
--logstore_name="logstore-a" \
--format-output=json
Check that the ttl and enable_tracking fields in the JSON output match the values you set.
References
Error codes -- troubleshoot failed API calls
UpdateLogStore API -- the underlying REST API for this command
Manage a Logstore by using Java SDK and Manage a Logstore by using Python SDK -- SDK alternatives
Alibaba Cloud OpenAPI Explorer for SLS -- common SDK integration