samber / slog-fiber

🚨 Fiber middleware for slog logger
https://pkg.go.dev/github.com/samber/slog-fiber
MIT License
53 stars 9 forks source link

kong logs #20

Closed wade-liwei closed 5 months ago

wade-liwei commented 6 months ago

Do you have an example of logging a Kong proxy log?

If I run the fiber web service with slog-fiver (default param) + kong proxy, it will work ok. If I run the fiber web service with slog-fiver (following param) + kong proxy, it will not work ok.

cfg := slogfiber.Config{
    WithUserAgent:      true,
    WithRequestID:      true,
    WithRequestBody:    true,
    WithRequestHeader:  true,
    WithResponseBody:   true,
    WithResponseHeader: true,
    WithSpanID:         true,
    WithTraceID:        true,
    DefaultLevel:     slog.LevelInfo,
    ClientErrorLevel: slog.LevelWarn,
    ServerErrorLevel: slog.LevelError,
}
samber commented 6 months ago

Can you explain the error ?

Your message is not very helpful.

wade-liwei commented 6 months ago

I did not find any errors. Could you please help me to find the errors?

wade-liwei commented 6 months ago

If I enable the parameter "WithRequestHeader: true, " with kong proxy, then I will can not get the log.

I guess kong with not standard http headers.

samber commented 6 months ago

Did you try to bypass kong and reach the HTTP service directly, in order to test the logger?

wade-liwei commented 6 months ago

Yea, If I run the fiber web service with slog-fiver (default param) + kong proxy, it will work ok. If I run the fiber web service with slog-fiver (following param) + kong proxy, it will not work ok.

cfg := slogfiber.Config{ WithUserAgent: true, WithRequestID: true, WithRequestBody: true, WithRequestHeader: true, WithResponseBody: true, WithResponseHeader: true, WithSpanID: true, WithTraceID: true, DefaultLevel: slog.LevelInfo, ClientErrorLevel: slog.LevelWarn, ServerErrorLevel: slog.LevelError, }

If I run the fiber web service with slog-fiver, it will work ok.

samber commented 6 months ago

You did not reply to my questoin.

wade-liwei commented 6 months ago

Did you try to bypass kong and reach the HTTP service directly, in order to test the logger?

yea, bypass kong and reach the HTTP service directly. no problem.

samber commented 5 months ago

can you provide a repository to reproduce the error?

wade-liwei commented 5 months ago

I found out the problem is Loki http rate limit, Thank you, good man.