All Products
Search
Document Center

Simple Log Service:create_logstore

Last Updated:Jun 03, 2026

Creates a Logstore in a specified project.

Prerequisites

Ensure the following:

Command syntax

aliyunlog log create_logstore \
  --project_name=<value> \
  --logstore_name=<value> \
  [--ttl=<value>] \
  [--shard_count=<value>] \
  [--enable_tracking=<value>] \
  [--append_meta=<value>] \
  [--auto_split=<value>] \
  [--max_split_shard=<value>] \
  [--preserve_storage=<value>] \
  [--encrypt_conf=<value>] \
  [--telemetry_type=<value>] \
  [--hot_ttl=<value>] \
  [--mode=<value>] \
  [--access-id=<value>] \
  [--access-key=<value>] \
  [--sts-token=<value>] \
  [--region-endpoint=<value>] \
  [--client-name=<value>] \
  [--jmes-filter=<value>] \
  [--format-output=<value>] \
  [--decode-output=<value>] \
  [--profile=<value>]

Examples

Create a Logstore with default settings

Create a Logstore named logstore-a in the project aliyun-test-project:

aliyunlog log create_logstore \
  --project_name="aliyun-test-project" \
  --logstore_name="logstore-a"

No output on success. Verify:

aliyunlog log get_logstore \
  --project_name="aliyun-test-project" \
  --logstore_name="logstore-a" \
  --format-output=json

Create a Logstore with a named account

Create a Logstore named logstore-b using the account test:

aliyunlog log create_logstore \
  --project_name="aliyun-test-project" \
  --logstore_name="logstore-b" \
  --client-name="test"

Verify the result:

aliyunlog log get_logstore \
  --project_name="aliyun-test-project" \
  --logstore_name="logstore-b" \
  --client-name="test" \
  --format-output=json

Sample response:

{
  "appendMeta": false,
  "archiveSeconds": 0,
  "autoSplit": true,
  "createTime": 1719280391,
  "enable_tracking": false,
  "lastModifyTime": 1719282255,
  "logstoreName": "logstore-b",
  "maxSplitShard": 64,
  "mode": "standard",
  "productType": "",
  "resourceQuota": {
    "storage": {
      "preserved": -1,
      "used": 0
    }
  },
  "shardCount": 5,
  "telemetryType": "",
  "ttl": 30
}

Parameters

Command-specific parameters only. Global parameters (--access-id, --access-key, --sts-token, --region-endpoint, --client-name, --jmes-filter, --format-output, --decode-output, --profile) are covered in Global parameters.

Required parameters

Parameter Type Description Example
--project_name String The project name. See Manage a project. aliyun-test-project
--logstore_name String The Logstore name. Cannot be changed after creation. See Naming rules. logstore-a

Optional parameters

Parameter Type Default Description Example
--ttl Integer 30 Data retention in days (1–3650). Set to 3650 for permanent storage. Expired data is deleted. Total retention = hot + IA + Archive storage periods. 30
--shard_count Integer -- Number of shards (1–10). MD5 value range. 2
--enable_tracking Boolean false Enables web tracking. true
--append_meta Boolean false Records public IP addresses. false
--auto_split Boolean true Enables automatic sharding. true
--max_split_shard Integer 64 Maximum number of shards for automatic splitting. Valid values: 1 to 256. Required when --auto_split is true. 64
--preserve_storage Boolean false Enables permanent storage. When true, --ttl is ignored and data is stored permanently. true
--encrypt_conf String None Encryption configuration. Data structure: EncryptConf. None
--telemetry_type String None Type of observable data. Valid values: None (logs), Metrics (metrics).
Important

Cannot be changed after creation.

None
--hot_ttl Integer -- Hot storage retention in days. Minimum: 7. Maximum: cannot exceed --ttl. Set to -1 to keep all data in hot storage. After this period, data moves to IA storage. Storage tier rules. 60
--mode String standard Logstore type. Valid values: standard (Standard Logstore), query (Query Logstore).
Important

Cannot be changed after creation. See Choose a Logstore type.

standard

Naming rules

--logstore_name requirements:

  • 3 to 63 characters in length

  • Can contain lowercase letters, digits, hyphens (-), and underscores (_)

  • Must start with a lowercase letter

  • Must end with a lowercase letter or a digit

  • Must be globally unique

  • Cannot be changed after creation

Choose a Logstore type

The --mode parameter sets the Logstore type:

Feature Standard Logstore (standard) Query Logstore (query)
Log analysis (SELECT statements) Supported Not supported
Dashboard Supported Not supported
Index traffic cost Standard rate Approximately half the standard rate
Best for Real-time monitoring, interactive analysis, full observability Large-volume ingestion with long retention, search-only workloads

Logstore comparison by type.

Storage tier rules

The --hot_ttl parameter controls how long data stays in hot storage before transitioning to lower-cost tiers. Minimum retention per tier:

Transition Minimum retention
Hot storage to Infrequent Access (IA) storage 7 days in hot storage
IA storage to Archive storage 30 days in IA storage
Hot storage to Archive storage (direct) 30 days in hot storage

Transition policies are detailed in Configure intelligent tiered storage.

References