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

Chat-ui Audit Logs #1148

Open
Neb2653 opened this issue May 16, 2024 · 5 comments
Open

Chat-ui Audit Logs #1148

Neb2653 opened this issue May 16, 2024 · 5 comments

Comments

@Neb2653
Copy link

Neb2653 commented May 16, 2024

Hello,

Is there a way to log the username, sessionID, conversation ID, what question was sent in some type of log in chat-ui ? Or just the username and the question?

How can we accomplish this?

Thanks

@adhishthite
Copy link
Contributor

Hey!

I have done this using Elasticsearch and APM. Can't share exact details with you, but start with replacing the Pino logger and use Elasticsearch instead.

You can log session ID, username, conversationID, requestID, and much more. You can ingest the Mongo data in Elastic too - if you need that.

@Neb2653
Copy link
Author

Neb2653 commented May 21, 2024

Hello,

We have the logs in elastic but without replacing the Pino logger (using the filebeat, logstash).
But where can I find the username? In which log? Not able to see it in the logs to match the username with the other information.

Regards

@adhishthite
Copy link
Contributor

In my case, I am logging the user details by retrieving it from the locals variable.

transaction?.setLabel("userEmail", event.locals.user?.email ?? "unknown");

You can get sessionId from locals as well.

@adhishthite
Copy link
Contributor

In the code above, I am basically setting the APM transaction metadata. But you can fetch the userEmail in a similar way and log it.

@adhishthite
Copy link
Contributor

Even if you do this:

logger.debug({
	...event.locals,
	url: event.url.pathname,
	params: event.params,
	request: event.request,
	message: `request for ${routeName} with status ${response.status}`,
});

You can log all the required values.

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