Skip to content

[ansi_stripper] stripper doesn't strip color? #2202

@KannarFr

Description

@KannarFr

Hi,

ansi_stripper transform doesn't remove ansi color from field?

For the following test:

[transforms.ansi_stripper_simple_yo]
  inputs = []
  type = "ansi_stripper"
  field = "message"
[[tests]]
  name = "ansi_stripper_simple_yo"
  [tests.input]
    insert_at = "ansi_stripper_simple_yo"
    type = "raw"
    value = "\t\r\\033[31mHelloWorld"
  [[tests.outputs]]
    extract_from = "ansi_stripper_simple_yo"
    [[tests.outputs.conditions]]
      "message.equals" = "HelloWorld"

It outputs:

check transform 'ansi_stripper_simple_yo' failed conditions:
  condition[0]: predicates failed: [ message.equals: "HelloWorld" ]
payloads (events encoded as JSON):
  input: {"message":"\t\r\\033[31mHelloWorld","timestamp":"2020-04-02T03:52:42.774856684Z"}
  output: {"message":"\\033[31mHelloWorld","timestamp":"2020-04-02T03:52:42.774856684Z"}

Maybe it's a wanted behavior and we should write ansi_color_stripper? WDYT?

Metadata

Metadata

Assignees

Labels

have: shouldWe should have this feature, but is not required. It is medium priority.type: bugA code related bug.type: helpUser support and help.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions