All Products
Search
Document Center

Simple Log Service:Encode and decode data

Last Updated:Aug 15, 2023

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

Important You can use form configuration to add Logtail plug-ins only if you select Kubernetes - Standard Output in the Import Data section.

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 Entry point.

Base64 encoding

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

Form configuration

Set the Processor Type parameter to BASE64 (Encoding). The following table describes the parameters.

Parameter

Description

Original Field

The name of the original field.

New Field

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

Report Original Field Missing Error

If you select this option and a raw log does not contain the specified original field, an error is reported.

Editor configuration in JSON

The following table describes the parameters that you can configure in the detail parameter if you set the type parameter to processor_base64_encoding.

Parameter

Type

Required

Description

SourceKey

String

Yes

The name of the original field.

NewKey

String

Yes

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

NoKeyError

Boolean

No

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

  • true: reports an error.

  • false: does not report an error. This is the default value.

Base64 decoding

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

Form configuration

Set the Processor Type parameter to BASE64 (Decoding). The following table describes the parameters.

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

If you select this option and a raw log does not contain the specified original field, an error is reported.

Report Decoding Failure Error

If you select this option and the decoding fails, an error is reported.

Editor configuration in JSON

The following table describes the parameters that you can configure in the detail parameter if you set the type parameter to processor_base64_decoding.

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 a raw log does not contain the specified original field. Valid values:

  • true: reports an error.

  • false: does not report an error. This is the default value.

DecodeError

Boolean

No

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

  • true: reports an error.

  • false: does not report an error. This is the default value.

MD5 encoding

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

Form configuration

Set the Processor Type parameter to MD5. The following table describes the parameters.

Parameter

Description

Original Field

The name of the original field.

New Field

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

Report Original Field Missing Error

If you select this option and a raw log does not contain the specified original field, an error is reported.

Editor configuration in JSON

The following table describes the parameters that you can configure in the detail parameter if you set the type parameter to processor_md5.

Parameter

Type

Required

Description

SourceKey

String

Yes

The name of the original field.

MD5Key

String

Yes

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

NoKeyError

Boolean

No

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

  • true: reports an error.

  • false: does not report an error. This is the default value.