All Products
Search
Document Center

Simple Log Service:Encode and decode data

Last Updated:Aug 16, 2024

When you use Logtail to collect logs, you can use the processor_base64_encoding and processor_md5 plug-ins to encode field values and the processor_base64_decoding plug-in to decode field values. This topic describes the parameters of the plug-ins and provides examples on how to configure the plug-ins.

Important
  • Form configuration: You can use form configuration to collect text logs and container stdout and stderr.

  • Editor configuration in JSON: You cannot use editor configuration in JSON to collect text logs.

Entry point

If you want to use a Logtail plug-in to process logs, you can add a Logtail plug-in configuration when you create or modify a Logtail configuration. For more information, see Overview of Logtail plug-ins for data processing.

Base64 encoding

You can use the processor_base64_encoding plug-in to encode field values.

Form configuration

Set Processor Type to BASE64 (Encoding). Then, configure other parameters based on the following table.

Parameter

Description

Original Field

The name of the original field.

New Field

The name of the new field to which the encoded value is assigned.

Report Original Field Missing Error

Specifies whether to report an error if the raw log does not contain the original field.

Editor configuration in JSON

Set type to processor_base64_encoding. Then, configure other parameters in detail based on the following table.

Parameter

Type

Required

Description

SourceKey

String

Yes

The name of the original field.

NewKey

String

Yes

The name of the new field to which the encoded value is assigned.

NoKeyError

Boolean

No

Specifies whether to report an error if the raw log does not contain the original field. Valid values:

  • true

  • false (default)

Base64 decoding

You can use the processor_base64_decoding plug-in to decode field values.

Form configuration

Set Processor Type to BASE64 (Decoding). Then, configure other parameters based on the following table.

Parameter

Description

Original Field

The name of the original field.

New Field

The name of the new field to which the decoded value is assigned.

Report Original Field Missing Error

Specifies whether to report an error if the raw log does not contain the original field.

Report Parsing Failure Error

Specifies whether to report an error if parsing fails.

Editor configuration in JSON

Set type to processor_base64_decoding.Then, configure other parameters in detail based on the following table.

Parameter

Type

Required

Description

SourceKey

String

Yes

The name of the original field.

NewKey

String

Yes

The name of the new field to which the decoded value is assigned.

NoKeyError

Boolean

No

Specifies whether to report an error if the raw log does not contain the original field. Valid values:

  • true

  • false (default)

DecodeError

Boolean

No

Specifies whether to report an error if parsing fails. Valid values:

  • true

  • false (default)

MD5 encoding

You can use the processor_md5 plug-in to encode field values by using the MD5 algorithm.

Form configuration

Set Processor Type to MD5. Then, configure other parameters based on the following table.

Parameter

Description

Original Field

The name of the original field.

New Field

The name of the new field to which the encoded value is assigned.

Report Original Field Missing Error

Specifies whether to report an error if the raw log does not contain the original field.

Editor configuration in JSON

Set type to processor_md5. Then, configure other parameters in detail based on the following table.

Parameter

Type

Required

Description

SourceKey

String

Yes

The name of the original field.

MD5Key

String

Yes

The name of the new field to which the encoded value is assigned.

NoKeyError

Boolean

No

Specifies whether to report an error if the raw log does not contain the original field. Valid values:

  • true

  • false (default)