Skip to content
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

logback encoder field becomes decoded with otel java instrumentation agent #12757

Closed
howan36 opened this issue Nov 20, 2024 · 9 comments
Closed

Comments

@howan36
Copy link

howan36 commented Nov 20, 2024

    <springProfile name="prod">
        <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
            <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
                <layout class="com.ikea.common.spring.filter.http.CustomPatternLayout">
                    <maskPattern>(?:name|firstName|lastName|customerName)\s*(?:=|:)\s*(.+?) .</maskPattern>
                    <maskPattern>(?:address1|customerAddress)\s*(?:=|:)\s*(.+?) .</maskPattern>
                    <maskPattern>\\?"(?:address1|customerAddress)\\?"\s*:\s*\\?"(.+?)\\?"</maskPattern>
                    <maskPattern>\\?"(?:name|firstName|lastName|customerName)\\?"\s*:\s*\\?"(.+?)\\?"</maskPattern>
                    <hashPattern>\\?"(?:mobile|phone|phoneNumber|communicationPhone)\\?"\s*:\s*\\?"([+\d]+)\\?"</hashPattern>
                    <hashPattern>(?:PHONE|phone|phoneNumber|communicationPhone|mobile)\s*(?:=|:)\s*([+\d]+)</hashPattern>
                    <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [trace_id=%X{trace_id} span_id=%X{span_id}] [%p][%c#%M:%L] -> %m%n</pattern>
                </layout>
            </encoder>
        </appender>

        <root level="info">
            <appender-ref ref="CONSOLE"/>
        </root>
    </springProfile>

we use the above config to encode some sensitive field, but after received from collector, it becomes decoded

@howan36
Copy link
Author

howan36 commented Nov 20, 2024

if there are some configurations could solve that, or something missing from my side

@howan36
Copy link
Author

howan36 commented Nov 20, 2024

No description provided.

@laurit
Copy link
Contributor

laurit commented Nov 21, 2024

The layout patterns you have configured are for the console appender. Otel appender is not connected to the console appender and does not use this configuration. I believe you can use the collector to apply these patterns to the log data.

@laurit laurit added the needs author feedback Waiting for additional feedback from the author label Nov 21, 2024
@howan36
Copy link
Author

howan36 commented Nov 21, 2024

ok, thanks a lot @laurit , besides, if otel log appender could output the log format to json, i found some field s were extracted to attributes labels, and the log body seems to be text mode

@github-actions github-actions bot removed the needs author feedback Waiting for additional feedback from the author label Nov 21, 2024
@howan36
Copy link
Author

howan36 commented Nov 21, 2024

for this log, the first row is the original message, and the json is the content i use transform processor to concat from attributes, if they could combine into 1 big json

@laurit
Copy link
Contributor

laurit commented Nov 22, 2024

I don't follow what the ask is here. Otel appender dispatches data to the exporter which decides the output format, by default otlp is used.

@laurit laurit added the needs author feedback Waiting for additional feedback from the author label Nov 22, 2024
Copy link
Contributor

This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed automatically if there is no response from the author within 7 additional days from this comment.

@github-actions github-actions bot added the stale label Nov 29, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2024
@howan36
Copy link
Author

howan36 commented Dec 7, 2024

ok thanks lot @laurit , i could look into the logbak appendar later, thanks again.

@github-actions github-actions bot removed needs author feedback Waiting for additional feedback from the author stale labels Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants