Creates a Logstore.

Request 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>] [--access-id=<value>] [--access-key=<value>] [--sts-token=<value>] [--region-endpoint=<value>] [--client-name=<value>] [--jmes-filter=<value>] [--format-output=<value>] [--decode-output=<value>]

Request parameters

The following table describes the required and specific parameters of the create_logstore command.
Parameter Type Required Example Description
--project_name String Yes aliyun-test-project The name of the project.
--logstore_name String Yes logstore-a The name of the Logstore. The name must meet the following requirements:
  • The name must be unique in a project.
  • The name can contain only lowercase letters, digits, hyphens (-), and underscores (_).
  • The name must start and end with a lowercase letter or digit.
  • The name must be 3 to 63 characters in length.
--ttl Integer No None The data retention period. Unit: days. Valid values: 1 to 3650. If you set the value to 3650, the data is permanently stored.
--shard_count Integer No None The number of shards. Valid values: 1 to 10.
--enable_tracking Boolean No None Specifies whether to enable the WebTracking feature. Default value: false. Valid values:
  • true: enables the WebTracking feature
  • false: disables the WebTracking feature
--append_meta Boolean No None Specifies whether to record public IP addresses. Default value: false. Valid values:
  • true: Public IP addresses are recorded.
  • false: Public IP addresses are not recorded.
--auto_split Boolean No None Specifies whether to enable automatic sharding. Default value: false. Valid values:
  • true: enables automatic sharding
  • false: disables automatic sharding
--max_split_shard Integer No None The maximum number of shards that are allowed for automatic sharding. Valid values: 1 to 64. If you set the --autoSplit parameter to true, you must specify the maxSplitShard parameter.
For information about the global parameters of the Log Service command-line interface (CLI), see Global variables.

Examples

  • Sample requests
    Use the default account to create a Logstore named logstore-a.
    aliyunlog log create_logstore --project_name="aliyun-test-project" --logstore_name="logstore-a"
  • Sample responses

    After you run the command, no responses are returned.

Error codes

If an error message is returned, fix the error based on the error codes of the related API operation. For more information, see Error codes of CreateLogstore.

API reference

CreateLogstore