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 timestamps to logging. #6

Closed
spankywetfish opened this issue Aug 3, 2022 · 2 comments
Closed

Feature Request : Add timestamps to logging. #6

spankywetfish opened this issue Aug 3, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@spankywetfish
Copy link

I'm currently troubleshooting a graphql authentication issue and the lack of timestamps in the logs has made correlation between mythic_sync activities and Ghostwriter more difficult than it should be.

For my issue I've added a sketchy datetime.now entry to the log exception string in sync.py, however I'm more than aware that this will not be optimal and should be done properly and more in line with the style of the code.

@chrismaddalena
Copy link
Contributor

Hey @spankywetfish,

That's a good idea. Ghostwriter's logger format is:

%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s"

That might be overkill for mythic_sync because it's one self-contained module. Module name (always sync), process ID, and thread don't add much except extra text. For example:

$ sudo ./mythic-cli logs mythic_sync
INFO 2022-08-03 21:26:30,950 sync 1 139654029557064 Successfully connected to Redis
INFO 2022-08-03 21:26:30,950 sync 1 139654029557064 Attempting to connect to https://mythic_nginx:7443
INFO 2022-08-03 21:26:30,973 sync 1 139654029557064 Successfully connected to https://mythic_nginx:7443
INFO 2022-08-03 21:26:30,973 sync 1 139654029557064 Trying to authenticate to Mythic
INFO 2022-08-03 21:26:30,973 sync 1 139654029557064 Authenticating to Mythic, https://mythic_nginx:7443, with username and password
INFO 2022-08-03 21:26:31,409 sync 1 139654029557064 Successfully authenticated to Mythic
INFO 2022-08-03 21:26:31,409 sync 1 139654029557064 Sending the initial Ghostwriter log entry
INFO 2022-08-03 21:26:31,455 sync 1 139654029557064 Starting subscription for tasks
INFO 2022-08-03 21:26:32,793 sync 1 139654029557064 Starting subscription for callbacks
DEBUG 2022-08-03 21:26:32,842 sync 1 139654029557064 Updating task: e5573be0-17ab-4edf-adaf-89d65d295053 - 8 : 2
DEBUG 2022-08-03 21:26:32,877 sync 1 139654029557064 Updating task: d0e96ba9-e598-4f8b-a78d-96df1d5c11c0 - 7 : 3
DEBUG 2022-08-03 21:26:32,907 sync 1 139654029557064 Updating task: 9610fc9a-4b17-420a-b20a-736939039119 - 6 : 4

I'll add asctime to the logger so logs look like this:

DEBUG 2022-08-03 21:26:32,842 Updating task: e5573be0-17ab-4edf-adaf-89d65d295053 - 8 : 2
DEBUG 2022-08-03 21:26:32,877 Updating task: d0e96ba9-e598-4f8b-a78d-96df1d5c11c0 - 7 : 3
DEBUG 2022-08-03 21:26:32,907 Updating task: 9610fc9a-4b17-420a-b20a-736939039119 - 6 : 4

Let us know if you have any thoughts. It's very easy to adjust the log format on line 16.

@chrismaddalena chrismaddalena self-assigned this Aug 3, 2022
@chrismaddalena chrismaddalena added the enhancement New feature or request label Aug 3, 2022
@spankywetfish
Copy link
Author

Perfect, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants