Skip to main content

Alibaba Cloud OSS

Alibaba Cloud Long Term Storage

Synopsis

Creates a target that writes log messages to Alibaba Cloud Object Storage Service (OSS) with support for various file formats and authentication methods. The target handles large file uploads efficiently with configurable rotation based on size or event count. Alibaba Cloud OSS provides secure, cost-effective, and high-durability object storage with strong presence in Asia-Pacific regions.

Schema

- name: <string>
description: <string>
type: alibabas3
pipelines: <pipeline[]>
status: <boolean>
properties:
key: <string>
secret: <string>
session: <string>
region: <string>
endpoint: <string>
part_size: <numeric>
bucket: <string>
buckets:
- bucket: <string>
name: <string>
format: <string>
compression: <string>
extension: <string>
schema: <string>
name: <string>
format: <string>
compression: <string>
extension: <string>
schema: <string>
max_size: <numeric>
batch_size: <numeric>
timeout: <numeric>
field_format: <string>
debug:
status: <boolean>
dont_send_logs: <boolean>

Configuration

The following fields are used to define the target:

FieldRequiredDefaultDescription
nameYTarget name
descriptionN-Optional description
typeYMust be alibabas3
pipelinesN-Optional post-processor pipelines
statusNtrueEnable/disable the target

Alibaba Cloud OSS Credentials

FieldRequiredDefaultDescription
keyY-Alibaba Cloud OSS access key ID
secretY-Alibaba Cloud OSS access key secret
sessionN-STS temporary session token (for short-lived credentials)
regionY-Alibaba Cloud region (e.g., oss-cn-hangzhou, oss-us-west-1, oss-ap-southeast-1)
endpointY-OSS endpoint URL (format: https://oss-<region>.aliyuncs.com)

Connection

FieldRequiredDefaultDescription
part_sizeN5Multipart upload part size in megabytes (minimum 5MB)
timeoutN30Connection timeout in seconds
field_formatN-Data normalization format. See applicable Normalization section

Files

FieldRequiredDefaultDescription
bucketN*-Default OSS bucket name (used if buckets not specified)
bucketsN*-Array of bucket configurations for file distribution
buckets.bucketY-OSS bucket name
buckets.nameY-File name template
buckets.formatN"json"Output format: json, multijson, avro, parquet
buckets.compressionN-Compression algorithm. See the Compression section below
buckets.extensionNMatches formatFile extension override
buckets.schemaN*-Schema reference (required for Avro and Parquet formats)
nameN"vmetric.{{.Timestamp}}.{{.Extension}}"Default file name template when buckets not used
formatN"json"Default output format when buckets not used
compressionNzstdDefault compression when buckets not used
extensionNMatches formatDefault file extension when buckets not used
schemaN-Default schema reference when buckets not used
max_sizeN33554432Maximum file size in bytes before rotation (default 32MB)
batch_sizeN100000Maximum number of messages per file

* = Either bucket or buckets must be specified. When using buckets, schema is conditionally required for Avro and Parquet formats.

note

When max_size is reached, the current file is uploaded to OSS and a new file is created. Setting max_size to 0 does not disable rotation — an explicit 0 is replaced by the 32 MB default (MustInt64), so there is no unlimited setting. Raise the value instead.

Scheduling

See Scheduling and Pool Behavior for interval and cron fields shared by all targets.

Debug Options

FieldRequiredDefaultDescription
debug.statusNfalseEnable debug logging
debug.dont_send_logsNfalseProcess logs but don't send to target (testing)

Details

The Alibaba Cloud OSS target writes log files to OSS buckets in any of the supported file formats. OSS offers 99.9999999999% (12 nines) data durability and strong regional coverage across Asia-Pacific, making it ideal for applications serving Asian markets.

Authentication

Requires Alibaba Cloud access credentials. Access keys can be created through the Alibaba Cloud Console under AccessKey Management. RAM (Resource Access Management) users can be created with specific OSS permissions for enhanced security.

Endpoint Configuration

The endpoint URL follows the pattern https://oss-<region>.aliyuncs.com where <region> is your chosen Alibaba Cloud region identifier. Internal endpoints are also available for ECS instances in the same region using https://oss-<region>-internal.aliyuncs.com for cost savings.

Available Regions

Alibaba Cloud OSS is available in numerous regions worldwide:

Region CodeLocation
oss-cn-hangzhouChina (Hangzhou)
oss-cn-shanghaiChina (Shanghai)
oss-cn-beijingChina (Beijing)
oss-cn-shenzhenChina (Shenzhen)
oss-cn-hongkongChina (Hong Kong)
oss-us-west-1US (Silicon Valley)
oss-us-east-1US (Virginia)
oss-ap-southeast-1Singapore
oss-ap-southeast-2Australia (Sydney)
oss-ap-southeast-3Malaysia (Kuala Lumpur)
oss-ap-southeast-5Indonesia (Jakarta)
oss-ap-northeast-1Japan (Tokyo)
oss-ap-south-1India (Mumbai)
oss-eu-central-1Germany (Frankfurt)
oss-eu-west-1UK (London)
oss-me-east-1UAE (Dubai)

File Formats

FormatDescription
jsonEach log entry is written as a separate JSON line (JSONL format)
multijsonAll log entries are written as a single JSON array
avroApache Avro format with schema
parquetApache Parquet columnar format with schema

Compression

Some formats support built-in compression to reduce storage costs and transfer times. When supported, compression is applied at the file/block level before upload.

FormatDefaultCompression Codecs
JSON-Not supported
MultiJSON-Not supported
Avrozstddeflate, snappy, zstd
Parquetzstdgzip, snappy, zstd, brotli, lz4

File Management

Files are rotated based on size (max_size parameter) or event count (batch_size parameter), whichever limit is reached first. Template variables in file names enable dynamic file naming for time-based partitioning.

Bucket Routing

The target supports flexible bucket routing through pipeline configuration or explicit bucket settings:

Configuration-based routing: Define multiple buckets in the target configuration, each with its own format, compression, and schema settings. Logs are routed to specific buckets based on configuration.

Pipeline-based routing: Use the bucket field in pipeline processors to dynamically route logs to different buckets at runtime. This enables conditional routing based on log content, source, or other attributes.

Catch-all routing: When a log doesn't match any specific bucket configuration or when no bucket field is set in the pipeline, logs are routed to the catch-all bucket (configured via the bucket field in target properties).

Routing priority:

  1. Pipeline bucket field (highest priority)
  2. Configured buckets in buckets array (if bucket name matches)
  3. Default bucket field (catch-all, lowest priority)

This multi-level routing enables flexible data distribution strategies, such as routing different log types to different buckets based on content analysis, source system, severity level, or any other runtime decision.

Templates

The following template variables can be used in file names:

VariableDescriptionExample
{{.Year}}Current year2024
{{.Month}}Current month01
{{.Day}}Current day15
{{.Timestamp}}Current timestamp in nanoseconds1703688533123456789
{{.Format}}File formatjson
{{.Extension}}File extensionjson
{{.Compression}}Compression typezstd
{{.TargetName}}Target namemy_logs
{{.TargetType}}Target typealibabas3
{{.Table}}Bucket namelogs
{{.Thread}}Writer thread index. The sender also appends this automatically when two threads would otherwise produce the same path, so an explicit token is only needed to control WHERE it lands3
{{.ServiceRoot}}The service root directory/opt/vmetric

Multipart Upload

Large files automatically use multipart upload protocol with configurable part size (part_size parameter). Default 5MB part size balances upload efficiency and memory usage.

Multiple Buckets

Single target can write to multiple OSS buckets with different configurations, enabling data distribution strategies (e.g., raw data to one bucket, processed data to another).

Schema Requirements

Avro and Parquet formats require a schema. The schema value can be a Library schema name, a built-in schema name, or an inline JSON definition. Parquet also accepts a schema file deployed under the schemas directory. Avro has no file lookup, so an Avro schema must be a name or inline JSON. See Avro and Parquet for the JSON definition format.

Storage Classes

Alibaba Cloud OSS supports multiple storage classes including Standard, Infrequent Access, Archive, and Cold Archive for cost optimization based on access patterns.

Regional Performance

OSS provides excellent performance for applications serving Asian markets with extensive regional presence across China, Southeast Asia, and other Asia-Pacific regions.

Examples

Basic Configuration

The minimum configuration for a JSON OSS target:

targets:
- name: basic_oss
type: alibabas3
properties:
key: "LTAI5tAbCdEfGhIjKlMnOpQr"
secret: "aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789"
region: "oss-cn-hangzhou"
endpoint: "https://oss-cn-hangzhou.aliyuncs.com"
bucket: "datastream-logs"

Multiple Buckets

Configuration for distributing data across multiple OSS buckets with different formats:

targets:
- name: multi_bucket_export
type: alibabas3
properties:
key: "LTAI5tAbCdEfGhIjKlMnOpQr"
secret: "aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789"
region: "oss-ap-southeast-1"
endpoint: "https://oss-ap-southeast-1.aliyuncs.com"
buckets:
- bucket: "raw-data-archive"
name: "raw-{{.Year}}-{{.Month}}-{{.Day}}-{{.Timestamp}}.json"
format: "multijson"
compression: "gzip"
- bucket: "analytics-data"
name: "analytics-{{.Year}}/{{.Month}}/{{.Day}}/data_{{.Timestamp}}.parquet"
format: "parquet"
schema: "<schema definition>"
compression: "snappy"

Multiple Buckets with Catch-All

Configuration for routing different log types to specific buckets with a catch-all for unmatched logs:

targets:
- name: multi_bucket_routing
type: alibabas3
properties:
key: "LTAI5tAbCdEfGhIjKlMnOpQr"
secret: "aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789"
region: "oss-cn-shanghai"
endpoint: "https://oss-cn-shanghai.aliyuncs.com"
buckets:
- bucket: "security-logs"
name: "security-{{.Year}}-{{.Month}}-{{.Day}}-{{.Timestamp}}.json"
format: "json"
- bucket: "application-logs"
name: "app-{{.Year}}-{{.Month}}-{{.Day}}-{{.Timestamp}}.json"
format: "json"
bucket: "general-logs"
name: "general-{{.Timestamp}}.json"
format: "json"

Parquet Format

Configuration for daily partitioned Parquet files:

targets:
- name: parquet_analytics
type: alibabas3
properties:
key: "LTAI5tAbCdEfGhIjKlMnOpQr"
secret: "aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789"
region: "oss-cn-shanghai"
endpoint: "https://oss-cn-shanghai.aliyuncs.com"
bucket: "analytics-lake"
name: "events/year={{.Year}}/month={{.Month}}/day={{.Day}}/part-{{.Timestamp}}.parquet"
format: "parquet"
schema: "<schema definition>"
compression: "snappy"
max_size: 536870912

High Reliability

Configuration with enhanced settings:

targets:
- name: reliable_oss
type: alibabas3
pipelines:
- checkpoint
properties:
key: "LTAI5tAbCdEfGhIjKlMnOpQr"
secret: "aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789"
region: "oss-cn-beijing"
endpoint: "https://oss-cn-beijing.aliyuncs.com"
bucket: "critical-logs"
name: "logs-{{.Timestamp}}.json"
format: "json"
timeout: 60
part_size: 10

With Field Normalization

Using field normalization for standard format:

targets:
- name: normalized_oss
type: alibabas3
properties:
key: "LTAI5tAbCdEfGhIjKlMnOpQr"
secret: "aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789"
region: "oss-ap-northeast-1"
endpoint: "https://oss-ap-northeast-1.aliyuncs.com"
bucket: "normalized-logs"
name: "logs-{{.Timestamp}}.json"
format: "json"
field_format: "cim"

Debug Configuration

Configuration with debugging enabled:

targets:
- name: debug_oss
type: alibabas3
properties:
key: "LTAI5tAbCdEfGhIjKlMnOpQr"
secret: "aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789"
region: "oss-cn-hangzhou"
endpoint: "https://oss-cn-hangzhou.aliyuncs.com"
bucket: "test-logs"
name: "test-{{.Timestamp}}.json"
format: "json"
debug:
status: true
dont_send_logs: true

Internal Endpoint

Configuration using internal endpoint for ECS instances in the same region:

targets:
- name: internal_oss
type: alibabas3
properties:
key: "LTAI5tAbCdEfGhIjKlMnOpQr"
secret: "aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789"
region: "oss-cn-shanghai"
endpoint: "https://oss-cn-shanghai-internal.aliyuncs.com"
bucket: "application-logs"
name: "logs/{{.Year}}/{{.Month}}/{{.Day}}/{{.Timestamp}}.json"
format: "json"
compression: "gzip"

Troubleshooting

The alibabas3 target behaves the same way as the Amazon S3 target and reports the same errors for the same causes: refused credentials, a bucket that does not exist, region and endpoint mistakes, upload timeouts, throttling, and buckets that stay empty. Use the Troubleshooting section of Amazon S3 for the full list of errors, causes, and fixes. See Target Delivery Errors for how Director logs and retries target failures.

Log lines and the connection status carry this target's name, so match on the cause text, which is the part after Reason: or after the last colon, rather than on the target name shown in the examples there.

What differs for Alibaba Cloud OSS

  • Startup probes the account, not one bucket. Before anything is sent, the target makes one list-buckets call, so the credentials need an account-wide list permission. A RAM user whose policy covers a single bucket cannot start the target, even though the same user can write objects into that bucket. You get api error AccessDenied after ListBuckets, and nothing is sent until the policy is widened.

  • key and secret must both be set. They are used only when both resolve to a non-empty value. There is no instance-role or ambient credential fallback that can work here, so an empty value leaves the target with no credentials at all and it reports no EC2 IMDS role found instead. A ${VAR} or $secret{...} reference that resolves to an empty string fails the same way while the configuration still looks complete.

  • region and endpoint must both be set, and they must agree. Use the region code, such as oss-cn-hangzhou, not the location name shown in the console. Set endpoint to the full URL, https://oss-<region>.aliyuncs.com, with the scheme included. Without endpoint the request goes to Amazon S3. Requests are signed with region, so an endpoint that serves another region typically answers with SignatureDoesNotMatch even though both values look correct on their own.

  • Name resolution and certificates cause most connection failures. Read the entry on the primary page that covers no such host, connection refused, and certificate signed by unknown authority. This target reads no TLS options, so a certificate issued by a private certificate authority has to be installed in the Director host's own trust store, and there is no setting that skips verification.

The internal endpoint resolves only inside its region

https://oss-<region>-internal.aliyuncs.com is reachable from ECS instances in that same region. When Director runs anywhere else, the hostname typically does not resolve and the target fails at startup with no such host. Use the public endpoint for the region instead.

note

No bucket name is checked at startup. The probe only confirms that the credentials can list the account, so a misspelled name under bucket or buckets passes startup and fails on the first upload routed to it.

tip

If a bucket holds only the last batch, check that every name template contains {{.Timestamp}}. A name built only from {{.Year}}, {{.Month}}, and {{.Day}} produces the same object key on every flush, and each upload replaces the one before it.