Git Product home page Git Product logo

Comments (5)

crobert-1 avatar crobert-1 commented on July 17, 2024 1

The code owners for pkg/ottl will have better insight than me here, but at a glance, the regex and replacement arguments in the replace_pattern function call need to be enclosed in double quotes as they're strings.

The following works for me:

- replace_pattern(attributes["Body"], "(?U)name\":\"(.*)\"", "name\":\"**********\"")

from opentelemetry-collector-contrib.

github-actions avatar github-actions commented on July 17, 2024

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

from opentelemetry-collector-contrib.

TylerHelmuth avatar TylerHelmuth commented on July 17, 2024

(?U)name\":\"(.*)\", name\":\"**********\", should become "(?U)name\":\"(.*)\", name\":\"**********\","

from opentelemetry-collector-contrib.

Marty1703 avatar Marty1703 commented on July 17, 2024

Doing so, the Collector fails with error:

2024-06-17T08:02:14.204Z warn [email protected]/expand.go:73 Variable substitution using $VAR will be deprecated in favor of ${VAR} and ${env:VAR}, please update $$ {"variable": "$"}
Error: invalid configuration: processors::transform/avg: unable to parse OTTL statement "replace_pattern(attributes[\"Body\"], \"(?U)name\\\":\\\"(.*)\\\", \"name\\\":\\\"**********\\\")": statement has invalid syntax: 1:64: invalid input text "\\\":\\\"**********\\..."
2024/06/17 08:02:14 collector server run finished with error: invalid configuration: processors::transform/avg: unable to parse OTTL statement "replace_pattern(attributes[\"Body\"], \"(?U)name\\\":\\\"(.*)\\\", \"name\\\":\\\"**********\\\")": statement has invalid syntax: 1:64: invalid input text "\\\":\\\"**********\\..."

from opentelemetry-collector-contrib.

TylerHelmuth avatar TylerHelmuth commented on July 17, 2024

You'll need to escape * as well: replace_pattern(attributes["Body"], "(?U)name\":\"(.*)\", name\":\"\*\*\*\*\*\*\*\*\*\*\",").

I suggest testing that your regex is well formatted and then adding it to your config.

from opentelemetry-collector-contrib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.