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

Add logging #2

Merged
merged 22 commits into from
Jan 31, 2025
Merged

Add logging #2

merged 22 commits into from
Jan 31, 2025

Conversation

daniellrgn
Copy link
Collaborator

Add log function to output messages to server std out
Add log endpoint for client logging

@ivan-c ivan-c requested review from mcjustin and ivan-c January 28, 2025 17:43
Copy link
Member

@ivan-c ivan-c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

server/routers/api.ts Outdated Show resolved Hide resolved
occurred: new Date().toISOString(),
subject: shl?.userId,
agent: {
ip_address: context.request.ip,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daniellrgn I'm finding that this is showing an internal network IP address (172.18.0.6). I had this same issue in cpro, @ivan-c suggested apache's HTTP_X_REAL_IP, which worked there. I don't know if you need something specific to traefik, or... I see some references to X-Forwarded-For https://stackoverflow.com/a/66003548 , and X-Real-IP... I don't see this as a blocker for today's release.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this in the most recent commit here, just had to flip a proxy setting. Now seeing my IP:
"agent":{"ip_address":"10.102.36.230",


function log(context: oak.Context, msg: types.LogMessageSimple, shl?: types.HealthLink) {
let logMessage: types.LogMessage = {
version: "2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daniellrgn this is supposed to be the version of the logserver schema, which is 3.0 (see here).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, missed that header. Fixed.

@daniellrgn daniellrgn merged commit 1acd9a3 into main Jan 31, 2025
1 check passed
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.

3 participants