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

Allowing users to customize timestamp format printed by pretty_ts() function #407

Merged
merged 8 commits into from
Aug 20, 2021

Conversation

perceptron01
Copy link
Contributor

@perceptron01 perceptron01 commented Aug 18, 2021

Description

This PR adds optional configuration of custom_pretty_ts_format, which provides a way to define custom format of timestamps printed in log messages and in alert messages.This function is realized by modifying pretty_ts() function in util.py and its related components.
custom_pretty_ts_format is expected to be specified like this in config.yaml.

custom_pretty_ts_format: '%Y-%m-%d %H:%M'

Checklist

Questions or Comments

CHANGELOG.md will be updated after the number of PR is fixed.
Updating CHANGELOG.md has been done.

Copy link
Owner

@jertel jertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@jertel jertel merged commit 80b7c4f into jertel:master Aug 20, 2021
@iamxeph iamxeph mentioned this pull request Aug 23, 2021
jertel added a commit that referenced this pull request Aug 23, 2021
Copy link
Contributor Author

@perceptron01 perceptron01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm very sorry for the bugs I've introduced.
I have found the typo that seems to be the cause of the problem.
I'll fix this in another PR.

@@ -78,6 +78,7 @@ def load_conf(args, defaults=None, overwrites=None):
conf.setdefault('disable_rules_on_error', True)
conf.setdefault('scan_subdirectories', True)
conf.setdefault('rules_loader', 'file')
conf.setdefault('custum_pretty_ts_format', None)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo in this line

NG: conf.setdefault('custum_pretty_ts_format', None)
OK: conf.setdefault('custom_pretty_ts_format', None)

@perceptron01 perceptron01 mentioned this pull request Aug 23, 2021
5 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants