-
Notifications
You must be signed in to change notification settings - Fork 115
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
No support for format #51
Comments
Thanks a lot for the feedback. I'm not entirely sure why do you need a formatter for this handler in particular? Could you give more context of what are you trying to achieve so we get a better understanding ? This handler is intended to pick up the full record (including the internal dict), serialise into a json doc and sent/store into elastic in bulk format. Formatters (please read https://docs.python.org/3.5/library/logging.html#formatter-objects) for more reference are responsible for converting a LogRecord to a string (usually) which can be interpreted by either a human or an external system. For the CMRESHandler, you do not need a formatter, the library will pick up the internal logrecord and inject directly into elastic. |
@saadqc I'm not sure what your use case is but you may be able to use filters to achieve what you're trying to do while using this log handler. https://docs.python.org/2/howto/logging-cookbook.html#filters-contextual |
@stephenpaulger @cmanaha : I switched to a different package after struggling with this. I will reproduce this issue and share my findings here. Otherwise close this PR. Thanks |
@saadqc Interested to hear what package you've switched to. I've had a different issue with this one when using ElasticSearch 6.5. |
@stephenpaulger : it's
|
@cmanaha One use case for using a formatter is Elastic Common Schema. The official Python support for ECS in elastic/ecs-logging-python is implemented as a formatter. |
I have a custom method to return logstash format. Although initializing it doesn't seem to work.
I noticed in
emit
method in handlers.pyself.format(record)
is being called but return dict is not stored anywhere.The text was updated successfully, but these errors were encountered: