Skip to content

yandex-cloud/fluent-bit-plugin-yandex

Repository files navigation

Fluent Bit plugin for Yandex Cloud Logging

Fluent Bit output for Yandex Cloud Logging.

Configuration parameters

All configuration parameters can be templated via metadata service. You can define templated value as follows: {{key:default}} or {{key}} (in this case "" used as default value). All strings matched this template will be replaced by metadata values. In default_payload parameter you also can use this template as a JSON value (without quotes), so that JSON struct or array will be included in default payload.

Key Description
group_id (optional) Log group ID. Has higher priority than folder_id.
folder_id (optional) Folder ID. Has lower priority than group_id. Can be auto-detected via metadata service if group_id and folder_id are not set.
resource_type (optional) Resource type of log entries. Can be templated via entry payload as follows: {entry/json/path}.
resource_id (optional) Resource id of log entries. Can be templated via entry payload as follows: {entry/json/path}.
stream_name (optional) Resource id of log entries. Can be templated via entry payload as follows: {entry/json/path}.
message_tag_key Key of the field to be assigned to the message tag. By default, will be skipped.
message_key Key of the field, which will go to message attribute of LogEntry.
level_key Key of the field, which contains log level, optional.
default_level (optional) Default level for messages, i.e., INFO.
default_payload (optional) String with default JSON payload for entries (will be merged together with custom entry payload).
endpoint (optional) API endpoint. Сan be set custom endpoint, for example, a regional one. Default value: api.cloud.yandex.net:443.
authorization See Authorization section below.

Metadata

Metadata service documentation.

Metadata url can be configured through environment variable YC_METADATA_URL. By default it's http://169.254.169.254.

Authorization

Configuration parameter authorization may have one of the following values:

Value Description
instance-service-account run on behalf of instance service account
iam-token environment variable YC_TOKEN
must contain a valid IAM token for authorization
iam-key-file:/path/key.json use IAM key for authorization

To create the key file, use yc cli. Example:

  yc iam key create --service-account-name my-service-account --output key.json

Configuration example

[OUTPUT]
    Name            yc-logging
    Match           *
    group_id        abc_{{group-id}}
    resource_type   {{resource}}_{resource/type}
    resource_id     {resource/id}
    message_key     text
    level_key       severity
    default_level   WARN
    default_payload {"num":5, "str": "string", "bool": true, "host":"{{instance/hostname}}", "not-found":"{{not/found:default}}", "struct": {{instance/disks/0}}, "array": {{instance/disks}} }
    authorization   instance-service-account