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

Feature Request: Add time to logs/output #1213

Open
danielsaporo opened this issue Jul 14, 2023 · 3 comments · May be fixed by #1301
Open

Feature Request: Add time to logs/output #1213

danielsaporo opened this issue Jul 14, 2023 · 3 comments · May be fixed by #1301
Labels
maintenance Care and feeding of this software project

Comments

@danielsaporo
Copy link

If I run Cartography from the terminal, I can see output for each step, but it's missing a timestamp. I can't quite see how long individual steps or indeed the overall run took without setting up a stats server. This can be solved by simply prepending the current timestamp when writing log output.

@achantavy
Copy link
Contributor

Cartography doesn't prepend a timestamp to the log msg itself because when the msg reaches a log aggregator like Kibana then Kibana will include the log msg as a field called msg and the timestamp in a separate field. Having the timestamp in both the msg and time fields is redundant in this case.

It'd be possible to allow a user to configure the log msg format - maybe by subclassing the python logger - but it'd still be a decent sized refactor.

Anyone have other ideas?

@danielsaporo
Copy link
Author

danielsaporo commented Jul 14, 2023

I might be a little pendantic here, but the time when the log was generated (let's call it event time) is not the same as the time that e.g. Elasticsearch auto-allocates (ingestion time).

To give you an idea where this concept would fail, if you're using Filebeat to ship logs to Elasticsearch, and Elasticsearch is down for a bit, then Filebeat would, upon reconnecting, send all the logs that were written since the last successful write, and they would all have the same timestamp.

Usually logging libraries support easy customisation of their output format, although I'd have to check about the Python one.

@achantavy
Copy link
Contributor

I'm open to customization of the logger output, hopefully it's a small refactor.

@chandanchowdhury chandanchowdhury linked a pull request May 1, 2024 that will close this issue
@chandanchowdhury chandanchowdhury added the maintenance Care and feeding of this software project label Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Care and feeding of this software project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants