Giter VIP home page Giter VIP logo

Comments (4)

robdasilva avatar robdasilva commented on August 24, 2024

Thanks for reaching out. As you correctly pointed out, the Timestamp column in CW shows the time that particular log output reached CW. IIRC there is the ability to put log events to CW using its API, which allows the timestamp to be specified (see https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html). However, personally I don't know of a way to override the Timestamp when streaming logs from stderr or stdout to CW.

Not sure, if I understand you correctly, but maybe the following could help: If you merely want to sort the logs by another value, you could include the timestamp when the log was emitted as part of the log context. That should enable you to sort messages in CW Logs Insights accordingly.

from lesslog.

HeroesDieYoung avatar HeroesDieYoung commented on August 24, 2024

Thanks for the response. I am mostly working with code running in Lambdas, so we're taking advantage of the default behavior of stdout and stderr from the containers being forwarded to CW. That mechanism doesn't expose any way for me to customize the log events being created to the best of my knowledge, as you say. I suppose I could make a logging library that writes to CW directly, instead of using stdout, but that feels pretty heavy handed.

At the moment I'm leaning towards looking for a richer log platform that will let me aggregate easily from multiple Lambdas, and pull the timestamp directly from the log line.

from lesslog.

robdasilva avatar robdasilva commented on August 24, 2024

Have you looked at CloudWatch Logs Insights yet? It might actually serve your purpose well. And since it's based on the CloudWatch logs there is no overhead of re-ingesting or submitting log messages elsewhere. Lesslog allows you to enrich your log messages with contextual information that is formatted in a way that Logs Insights is able to parse. Which allows you to filter, sort, group and search based on information in that context.

from lesslog.

HeroesDieYoung avatar HeroesDieYoung commented on August 24, 2024

I've looked at it just a little bit. At first glance it appeared that the @timestamp field still comes from event metadata in CW, not the contents of the log line itself. Parsing custom fields appears limited to JSON format logs.

EDIT: Oh, I missed a critical part of your statement, actually. I'll have a further look at your "context" feature and dig into that. If that will create an entry that insights can parse, maybe I can indeed use it to get some mileage. Thanks :-)

from lesslog.

Related Issues (2)

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.