Skip to content

feat(audit): show trace with HTTP's client_ip , user + trusted proxy#320

Open
EdouardVanbelle wants to merge 2 commits intoAtalayaLabs:mainfrom
EdouardVanbelle:feat/client_ip
Open

feat(audit): show trace with HTTP's client_ip , user + trusted proxy#320
EdouardVanbelle wants to merge 2 commits intoAtalayaLabs:mainfrom
EdouardVanbelle:feat/client_ip

Conversation

@EdouardVanbelle
Copy link
Copy Markdown
Contributor

@EdouardVanbelle EdouardVanbelle commented Apr 26, 2026

  • add support of trusted proxy via CIDR in OXICLOUD_TRUST_PROXY_CIDR env variable (comma separated of CIDR)
    note: OXICLOUD_TRUST_PROXY_HEADERS still possible but a log encourages use of OXICLOUD_TRUST_PROXY_CIDR

  • HTTP answers provide the X-Request-ID

  • logs: add trace/context with:

    • HTTP's client_ip (X-Forwarded-For if via a trusted proxy)
    • User's ID if logged in
    • show a uniq request id (helps correlation)
    • show the associated path

example of logs:

2026-04-26T23:30:28.654211Z  INFO req{request_id="019dcc21-50ad-72f3-834c-29bc395fae77" client_ip=127.0.0.1:62953 method=GET uri=/api/favorites user_id="81fbc3f3-0bca-43b9-bbc6-c743a1a49f04"}: oxicloud::application::services::favorites_service: Getting favorites for user: 81fbc3f3-0bca-43b9-bbc6-c743a1a49f04
2026-04-26T23:30:28.674672Z  INFO req{request_id="019dcc21-50c2-75a2-8dbf-a759a76c3d5d" client_ip=127.0.0.1:62956 method=GET uri=/api/auth/me user_id="81fbc3f3-0bca-43b9-bbc6-c743a1a49f04"}: oxicloud::application::services::storage_usage_service: Updating storage usage for user: 81fbc3f3-0bca-43b9-bbc6-c743a1a49f04
2026-04-26T23:30:28.693592Z  INFO req{request_id="019dcc21-50c2-75a2-8dbf-a759a76c3d5d" client_ip=127.0.0.1:62956 method=GET uri=/api/auth/me user_id="81fbc3f3-0bca-43b9-bbc6-c743a1a49f04"}: oxicloud::application::services::storage_usage_service: Updated storage usage for user 81fbc3f3-0bca-43b9-bbc6-c743a1a49f04 to 455442347 bytes
2026-04-26T23:30:28.693700Z  INFO req{request_id="019dcc21-50c2-75a2-8dbf-a759a76c3d5d" client_ip=127.0.0.1:62956 method=GET uri=/api/auth/me user_id="81fbc3f3-0bca-43b9-bbc6-c743a1a49f04"}: oxicloud::interfaces::api::handlers::auth_handler: Updated storage usage for user 81fbc3f3-0bca-43b9-bbc6-c743a1a49f04: 455442347 bytes
2026-04-26T23:30:28.744670Z  INFO req{request_id="019dcc21-50ad-72f3-834c-29bc395fae77" client_ip=127.0.0.1:62953 method=GET uri=/api/favorites user_id="81fbc3f3-0bca-43b9-bbc6-c743a1a49f04"}: oxicloud::application::services::favorites_service: Retrieved 7 favorites for user 81fbc3f3-0bca-43b9-bbc6-c743a1a49f04
2026-04-26T23:30:28.744729Z  INFO req{request_id="019dcc21-50ad-72f3-834c-29bc395fae77" client_ip=127.0.0.1:62953 method=GET uri=/api/favorites user_id="81fbc3f3-0bca-43b9-bbc6-c743a1a49f04"}: oxicloud::interfaces::api::handlers::favorites_handler: Retrieved 7 favorites for user 81fbc3f3-0bca-43b9-bbc6-c743a1a49f04

@EdouardVanbelle EdouardVanbelle marked this pull request as ready for review April 26, 2026 23:34
@DioCrafts
Copy link
Copy Markdown
Collaborator

@EdouardVanbelle I am checking it

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

Successfully merging this pull request may close these issues.

2 participants