eht16 / python-logstash-async

Python logging handler for sending log events asynchronously to Logstash.
MIT License
182 stars 52 forks source link

Modification to `constants.FORMATTER_RECORD_FIELD_SKIP_LIST` ignored since v3.0.0 #96

Closed feliixx closed 5 months ago

feliixx commented 6 months ago

Hi @eht16, thanks for maintaining this project! We've been using it in production for quite some time and it's really nice

We're removing some of the fields we send by modifying constants.FORMATTER_RECORD_FIELD_SKIP_LIST like this:

constants.FORMATTER_RECORD_FIELD_SKIP_LIST = \
    constants.FORMATTER_RECORD_FIELD_SKIP_LIST + [
        'custom_data', 'custom_message', 'func_name', 'interpreter',
        'interpreter_version', 'line', 'logsource',
        'logstash_async_version', 'pid', 'process_name', 'program',
        'thread_name']
transport = HttpTransport(host, port, username=username, password=password,
                          ssl_enable=True)
handler = AsynchronousLogstashHandler(host, port, None,  # in-memory cache
                                      transport=transport)
handler.setFormatter(LogstashFormatter(message_type='logstash',
                                       extra_prefix=None))

But we noticed that since v3.0.0, the fields in our custom list are no longer skipped. This seems to be linked to commit baf2118, so I'll send a PR to fix the regression.