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

Is it possible to merge http access logs and slow logs in rest? #3909

Open
marsmay opened this issue Feb 13, 2024 · 2 comments · May be fixed by #4103
Open

Is it possible to merge http access logs and slow logs in rest? #3909

marsmay opened this issue Feb 13, 2024 · 2 comments · May be fixed by #4103
Labels
area/logs Categorizes issue or PR as related to logs.

Comments

@marsmay
Copy link

marsmay commented Feb 13, 2024

1. Is it possible to merge http access logs and slow logs in rest?
When a request is too slow, the slow call log is triggered, and the access log of the request is also triggered, the information of these two logs is almost exactly the same, is it possible to consider not printing the access log anymore after outputting the slow call log?

2. Is it possible to configure an exception path for slow call logs?
In my project using websocket, the connection time is usually more than 60 seconds and almost every request prints the slow call log when the connection is closed, this is normal, tell me that the request is too slow is completely pointless and is a distraction.

2024-02-13T14:53:27.102+08:00    slow   [HTTP]  200  -  GET  /user/chat/ws?k_sso_token=l5NVP1jEaOOjavdlXAaY0GxW-vnBV9_Dga4SqIDSsnPqJXtO3x17TLLCm5N9tPOC86M7yzQ5nDNvuKBpJknkBC_cN4ifK9_KdmfupEWDiMFO700L-2NiYorNK65IrCPb4X4pOnq-ZIjbs_imlOebdhbYVm_RkD-Z3fHfttyoccQ.cv0 - 127.0.0.1:56662 - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3 Safari/605.1.15 - slowcall(19439.3ms)      duration=19439.3ms      caller=handler/loghandler.go:131        trace=a136e9df9c8329e8f22723e849c869e8    span=e2f34239c27f457d
2024-02-13T14:53:27.102+08:00    info   [HTTP]  200  -  GET  /user/chat/ws?k_sso_token=l5NVP1jEaOOjavdlXAaY0GxW-vnBV9_Dga4SqIDSsnPqJXtO3x17TLLCm5N9tPOC86M7yzQ5nDNvuKBpJknkBC_cN4ifK9_KdmfupEWDiMFO700L-2NiYorNK65IrCPb4X4pOnq-ZIjbs_imlOebdhbYVm_RkD-Z3fHfttyoccQ.cv0 - 127.0.0.1:56662 - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3 Safari/605.1.15    duration=19439.3ms      caller=handler/loghandler.go:147        trace=a136e9df9c8329e8f22723e849c869e8  span=e2f34239c27f457d

@kevwan
Copy link
Contributor

kevwan commented Feb 15, 2024

You can set the log writer, check out the example here: https://github.com/zeromicro/zero-contrib/tree/main/logx/zapx

@kevwan kevwan added the area/logs Categorizes issue or PR as related to logs. label Feb 15, 2024
@Suyghur
Copy link
Contributor

Suyghur commented Apr 24, 2024

I got the same problem, is there any good solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/logs Categorizes issue or PR as related to logs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants