Git Product home page Git Product logo

Comments (5)

adhishthite avatar adhishthite commented on August 25, 2024

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.

from chat-ui.

Neb2653 avatar Neb2653 commented on August 25, 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

from chat-ui.

adhishthite avatar adhishthite commented on August 25, 2024

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.

from chat-ui.

adhishthite avatar adhishthite commented on August 25, 2024

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.

from chat-ui.

adhishthite avatar adhishthite commented on August 25, 2024

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.

from chat-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.