百度智能云

All Product Document

          Log Service

          Create Log Shipper

          Description

          To create logshippers for specific logstores, the following guidelines shall be complied with:

          • More than one logshipper can be created per logstore, and the total logshippers are not more than 300
          • Logshipper name, at most 63 characters, including letters, digits, - and _
          • The delivery start time can be set to a minimum of 180 days in the past or a maximum of 24 hours in the future. By default, the task creation time is used as the start time. The format must meet ISO 8601.

          Request

          • Request syntax
          POST /v1/logshipper HTTP/1.1
          Host: bls-log.{region}.baidubce.com
          Authorization: authorization string
          • Request headers

          No additional headers are required beyond the standard request headers.

          • Request parameters
          Parameter name Types Required or not Parameter location Description
          project string no body Project name, default
          logStoreName string yes body Logstore name
          logShipperName string yes body Logshipper name
          startTime string no body Delivery start time
          destType string no body The delivery destination location type currently supports BOS only
          destConfig DestConfig yes body Target configuration details

          DestConfig structure:

          Parameter name
          Types
          Required or not Description
          BOSPath string yes BOSPath consists of a bucket plus a user-defined path, at most 256 characters
          partitionFormatTS string no Disk partition format, such as %Y/%m/%d/%H/%M/, support minute-level precision only, can be customized or empty; default: %Y/%m/%d/%H/%M/
          partitionFormatLogStream bool no Whether to use logstream as a partition level; default: false
          maxObjectSize int64 no Maximum object size, in MB, range: 1~ 5*1024*1024 (5TB); default: 64.
          compressType string no Compression type, optional parameters: snappy/gzip/bzip2/lzop and none; default: none
          deliverInterval int no Delivery interval, in minute, limit range: integers between 5 and 60; default: 5
          storageFormat string no Storage format, optional parameters: parquet, json, csv; default: json
          csvHeadline bool no Whether to deliver the field name in case of CSV; default: false (not deliver)
          csvDelimiter string no Separator in case of CSV, options: comma (,), space ( ), pipe (|), or tab (\t); default: comma
          csvQuote string no Quote character in case of CSV, options: single quote ('), double quote ("), none, or custom; default: none
          nullIdentifier string no In case of CSV, when column is empty, the filled specified content is empty by default
          selectedColumnName string Required in case of CSV and parquet In case of CSV and parquet, the selected column name, the column name parameters separated by comma
          selectedColumnType string Required in case of parquet In case of parquet, the selected column type, the column type parameters separated by comma

          Response

          • Response headers

          No additional headers are required beyond the standard response headers.

          • Response parameters
          Parameter name Types Can it be empty Description
          logShipperID string no Logshipper ID

          Error code

          Apart from standard error codes, the following codes may be returned:

          Error code Error message Description HTTP status code
          LogStoreNotFound LogStore [logStoreName] not exists Logstore not exist 404

          Note: [logStoreName] in error message may be replaced with a specific name.

          Example

          • Request example
          POST /v1/logshipper HTTP/1.1
          Host: bls-log.bj.baidubce.com
          Authorization:bce-auth-v1/18717522d39411e9b721df098b0b908c/2019-09-10T07:00:20Z/1800/content-type;host;x-bce-date;x-bce-request-id/6a7cb6c9ac7ec156c805e55e7d0bcfc443b47feee97cf099c1c0d93a0b4c8304
          Content-Type: application/json; charset=utf-8
          {
              "project":"default",
              "logStoreName":"logstore1",
              "logShipperName":"shipper1",
              "startTime":"2021-01-12T01:01:00Z",
              "destType":"BOS",
              "destConfig":{
                  "BOSPath":"users-Bucket1/",
                  "partitionFormatTS":"%Y/%m/%d/%H/%M/",
                  "partitionFormatLogStream":true,
                  "maxObjectSize":50,
                  "compressType":"snappy",
                  "deliverInterval":30,
                  "storageFormat":"json"
              }
          }
          • Response example
          HTTP/1.1 201
          Content-Type: application/json; charset=utf-8
          {
              "logShipperID":"123123-xxxxxxx"
          }
          Previous
          Index Related APIs
          Next
          Update Log Shipper