-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
built-in functions bug #36559
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Hi @howan36! To make this easier to reproduce, can you please share the full collector config yaml, along with an example input and expected outcome? Using the provided example statement, i do get an error as well, however a different one, since the |
Pinging code owners for pkg/ottl: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself. For example, comment '/label priority:p2 -needs-triaged' to set the priority and remove the needs-triaged label. |
transform: - context: log
|
i saw ottl support to use this golang built-in function? |
the int literals you mean like 2,3 numbers? or if you some other method to have the same function |
@howan36 just checked again - |
response: {"code":"0","message":null,"data":[{"customerId":xxxxx,"customerName":null,"gender":0,"phone":"xxxxxx","email":null,"birthYear":null,"birthMonth":null,"birthDay":null,"partyUid":"Cxxxxxxx","customerAddress":null,"wechatOpenId":"oPq0xxxxxxx","wechatUnionid":"ombktxxxxx","customerStatus":"AC","preferStoreName":"xxxxx","preferStoreCode":"549","registerStoreName":"xxxxx","registerStoreCode":"549","registerSource":"{"content":"SHOPPABLE_MINI_P="}","ctgProvinceId":null,"ctgProvinceName":null,"ctgCityId":null,"ctgCityName":null,"ctgDistrictId":null,"ctgDistrictName":null,"ctgSubDistrictId":0,"ctgSubDistrictName":null,"postalCode":null,"idCardNumber":null,"registerTime":1730166345903,"childStatus":null,"cdmCustomerChildDtoList":[],"cdmCustomerPreferenceDto":{"decorationPlan":null,"decorationPlanFlag":null,"outboundSmsFlag":true},"ikeaFamilySpaceIdList":[],"cdmMembershipDto":{"cardNumber":"627598033xxxxx5","wechatCardCode":null,"wechatOfficialAccountOpenId":null},"cardNumber":"6275xxxxxxxx","wechatCardCode":null,"wechatOfficialAccountOpenId":null,"houseOwnerShip":null,"livingStatus":{"status":null,"livingStatusList":[]},"migrationStatus":"N/A"}]} |
it's unstructed logs, for example, i want to replace the phone field with **** |
and maybe i will also need to extract its value to attributes |
thanks for the example, I will try to see if there is a way of handling this kind of unstructured log data |
@howan36 maybe something like the following config might be of help to handle unstructured log data like from the example you posted above:
This config first splits the log body lines into a slice, and then takes the line containing the json object and passes that line to the |
hi @bacherfl , thanks a lot for your response, so the functions that transform processor supported are all in this page:https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/ottl/ottlfuncs, and other go-lang built-in functions won't be supported? |
Exactly, the functions listed in those docs are the ones that are supported. Executing Golang functions directly is not possible |
@howan36 Would the ExtractPatterns function work for your use case? |
Component(s)
processor/transform
Describe the issue you're reporting
expression: - set(attributes["code"], Substring(body,indexOf(body,"code"),indexOf(body,"message")))
error:
Error: invalid configuration: processors::transform: unable to parse OTTL statement "set(attributes["code"], Substring(body,indexOf(body,"code"),indexOf(body,"message")))": error while parsing arguments for call to "set": invalid argument at position 1: error while parsing arguments for call to "Substring": invalid argument at position 1: no value field set. This is a bug in the OpenTelemetry Transformation Language
The text was updated successfully, but these errors were encountered: