create_consumer_group

更新时间:
复制 MD 格式

Creates a consumer group for a specified Logstore.

Request syntax

aliyunlog log create_consumer_group --project=<value> --logstore=<value> --consumer_group=<value> --timeout=<value> [--in_order=<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

Parameters specific to the create_consumer_group command.

Parameter

Type

Required

Example

Description

--project

String

Yes

aliyun-test-project

The project name.

--logstore

String

Yes

logstore-a

The Logstore name.

--consumer_group

String

Yes

consumer-group-1

The consumer group name. Must be unique within the project.

--timeout

Integer

Yes

300

The timeout period. Unit: seconds.

Consumers send periodic heartbeats to Log Service. If no heartbeat is received within this period, Log Service releases the consumer's resources.

--in_order

Boolean

No

true

Whether to consume shard data in sequence. Valid values:

  • true: Shard data is consumed in sequence. After a shard split, the original shard is consumed first, then the new shards are consumed simultaneously.

  • false (default): Shard data is consumed without guaranteed order.

For information about the global parameters of the Log Service command-line interface (CLI), see Global parameters.

Examples

  • Create a consumer group for logstore-a using the default account:

    aliyunlog log create_consumer_group --project="aliyun-test-project" --logstore="logstore-a" --consumer_group="consumer-group-1" --timeout="300" --in_order=true
  • Query the consumer group:

    aliyunlog log list_consumer_group --project="aliyun-test-project" --logstore="logstore-a"

    Sample response:

    [
      {
        "name": "consumer-group-1",
        "order": true,
        "timeout": 300
      }
    ]

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.

API reference

CreateConsumerGroup