Creates a consumer group for a Logstore.

Description

  • You can create up to 30 consumer groups for a Logstore.
  • Log Service provides examples of both regular log consumption and consumer group-based log consumption by using Log Service SDK for Java. For more information, see Consume log data and Use consumer groups to consume log data.

Request headers

This operation uses only common request headers. For more information, see Common request headers.

Request syntax

POST /logstores/{logstore}/consumergroups HTTP/1.1

Request parameters

Parameter Type Location Required Example Description
logstore String Path Yes aliyun-test-logstore

The name of the Logstore.

project String Host Yes aliyun-test-project

The name of the project.

consumerGroup String FormData Yes consumer-group-1

The name of the consumer group. The name must be unique in a project.

timeout Integer FormData Yes 300

The timeout period. If Log Service does not receive heartbeats from a consumer within the timeout period, Log Service deletes the consumer. Unit: seconds.

order Boolean FormData No true

Specifies whether to consume data in a shard in sequence. Valid values:

  • true: consumes data in a shard in sequence. If a shard is split, the data in the original shard is consumed first. Then, the data in the new shards is consumed at the same time.
  • false: does not consume data in a shard in sequence.

Response parameters

Parameter Type Example Description
Server String nginx

The name of the server.

Content-Length String 0

The length of the content.

Connection String close

Indicates whether the connection is persistent.

Access-Control-Allow-Origin String *

Indicates whether code from any origin is allowed to access the resource.

Date String Sun, 27 May 2018 08:25:04 GMT

The time.

x-log-requestid String 5B0A6B60BB6EE39764D458B5

The ID of the request.

Examples

Sample requests

POST /logstores/logstoreName/consumergroups HTTP/1.1
Host:aliyun-test-project.cn-hangzhou.log.aliyuncs.com
Content-Type:application/json

{ }

Sample success responses

JSON format

HTTP/1.1 200 OK

Error codes

For a list of error codes, visit the API Error Center.