Configuring the DIS Logstash Plugin

DIS Logstash Plugins consist of the Input and Output plugins. This section describes the configuration items of the plugins.

Configuring DIS Logstash Input

The configuration template (used to download data from a DIS stream to a local file) is as follows:

input
{
   dis {
        streams => ["YOU_DIS_STREAM_NAME"]
        endpoint => "https://${endpoint}"
        ak => "YOU_ACCESS_KEY_ID"
        sk => "YOU_SECRET_KEY_ID"
        region => "${region}"
        project_id => "YOU_PROJECT_ID"
        group_id => "YOU_APP_ID"
        auto_offset_reset => "earliest"
    }
}
output
{
    file {
       path => ["/tmp/test.log"]
   }
}
Table 1 DIS Logstash Input configuration parameters

Parameter

Mandatory

Description

Default Value

stream

Yes

DIS stream name.

The value of this parameter must be the same as that of Stream Name configured on the DIS console.

ak

Yes

User's AK.

For details about how to obtain an AK, see Checking Authentication Information.

-

sk

Yes

User's SK.

For details about how to obtain an SK, see Checking Authentication Information.

-

region

Yes

Region in which DIS is located.

cn-north-1

project_id

Yes

Project ID specific to your region.

For details about how to obtain a project ID, see Checking Authentication Information.

-

endpoint

Yes

Data API address of the region where DIS resides.

https://dis.cn-north-1.myhuaweicloud.com

group_id

Yes

DIS App name, used to identify a consumer group. The value can be any character string.

-

Configuring DIS Logstash Output

The configuration template (used to read data from a local file and upload it to a DIS stream) is as follows:

input
{
   file {
       path => ["/tmp/test.log"]
       type => "log4j"
       start_position => "beginning"
   }
}
output
{
    dis {
        stream => ["YOU_DIS_STREAM_NAME"]
        endpoint => "https://dis.${endpoint}"
        ak => "YOU_ACCESS_KEY_ID"
        sk => "YOU_SECRET_KEY_ID"
        region => "${region}"
        project_id => "YOU_PROJECT_ID"
    }
}
Table 2 DIS Logstash Output configuration parameters

Parameter

Mandatory

Description

Default Value

stream

Yes

DIS stream name.

The value of this parameter must be the same as that of Stream Name configured on the DIS console.

ak

Yes

User's AK.

For details about how to obtain an AK, see Checking Authentication Information.

-

sk

Yes

User's SK.

For details about how to obtain an SK, see Checking Authentication Information.

-

region

Yes

Region in which DIS is located.

cn-north-1

project_id

Yes

Project ID specific to your region.

For details about how to obtain a project ID, see Checking Authentication Information.

-

body_compress_enabled

No

Specifies whether to enable data compression.

No

body_compress_type

No

Data compression type. Currently, the following compression algorithms are supported:

lz4: a compression algorithm with a fast compression speed and high compression efficiency

zstd: a new lossless compression algorithm with a fast compression speed and high compression ratio

lz4