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.
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.
For information about the global parameters of the Log Service command-line interface (CLI), see Global variables.

Examples

  1. 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"
    }
  2. 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.

  3. Query the log shipping task that you created. Run the following command:
    aliyunlog log list_shipper --project="aliyun-test-project" --logstore="logstore-a"
    The following output is returned:
    {
      "count": 1,
      "shipper": [
        "sls-doc-testshippername"
      ],
      "total": 1
    }