Creates a log shipping task.
Request syntax
aliyunlog log create_shipper --project=<value> --logstore=<value> --detail=<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_shipper command.
For information about the global parameters of the Log Service command-line interface (CLI), see Global parameters.
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
--project | String | Yes | aliyun-test-project | The name of the project. |
--logstore | String | Yes | logstore-a | The name of the Logstore. |
--detail | String | Yes | file://./createshipper.json | The path of the configuration file for the log shipping task. |
Examples
- Create a file named createshipper.json to ship log data to Object Storage Service (OSS). The following example shows the content of the createshipper.json file:
{ "shipperName": "sls-doc-testshippername", "targetConfiguration": { "pathFormat": "%Y/%m/%d/%H/%M", "compressType": "none", "bufferSize": 256, "ossBucket": "sls-doc-test", "roleArn": "acs:ram::17464******745:role/aliyunlogdefaultrole", "timeZone": "", "bufferInterval": 300, "ossPrefix": "sls-doc-test", "storage": { "detail": { "enableTag": true }, "format": "json" } }, "targetType": "oss" }
- Use the default account to create a log shipping task. Run the following command:
aliyunlog log create_shipper --project="aliyun-test-project" --logstore="logstore-a" --detail="file://./createshipper.json"
After you run the command, no responses are returned.
- Query the log shipping task that you created. Run the following command:
The following output is returned:aliyunlog log list_shipper --project="aliyun-test-project" --logstore="logstore-a"
{ "count": 1, "shipper": [ "sls-doc-testshippername" ], "total": 1 }
For more information, see Send logs to OSS, MaxCompute.