Code Monkey home page Code Monkey logo

Comments (6)

eht16 avatar eht16 commented on June 30, 2024

Sorry for the late response.

I can't reproduce the described behavior with your example. It results in a message like (stripped unrelated fields for readability):

{
    "message": "some message.",
    "type": "python-logstash",
    "extra": {
        "some": "extra",
        "default": "extra",
    }
}

Which version of the library are you using?

from python-logstash-async.

droriv avatar droriv commented on June 30, 2024

I'm using python-logstash-async==2.3.0

from python-logstash-async.

eht16 avatar eht16 commented on June 30, 2024

I just tried with your code again, except that I replaced the logger with a standard Python logger instance and added the handler via logger.addHandler(logstash_handler) and got the expected result.

Might the loguru package related? I don't what it does.

For reference, here is a full message:

{
       "message" => "some message",
           "pid" => 551789,
         "extra" => {
                     "func_name" => "<module>",
           "interpreter_version" => "3.9.9",
                          "line" => 30,
        "logstash_async_version" => "2.3.0",
                  "process_name" => "MainProcess",
                          "some" => "extra",
                          "path" => "test_issue69.py",
                   "thread_name" => "MainThread",
                       "default" => "extra",
                   "interpreter" => "venv/bin/python",
                   "logger_name" => "root"
    },
          "host" => "redacted",
       "program" => "test_issue69.py",
      "@version" => "1",
    "@timestamp" => 2022-01-09T15:09:46.441Z,
          "port" => 37278,
          "type" => "python-logstash",
         "level" => "INFO",
     "logsource" => "redacted"
}

from python-logstash-async.

droriv avatar droriv commented on June 30, 2024

It might be related to loguru but as I mentioned I was able to track the problem, it's related to the _get_extra_fields method and after overriding it with the fix, the issue was resolved, is it ok if I'll open a pr for that fix?

from python-logstash-async.

eht16 avatar eht16 commented on June 30, 2024

Basically a PR is ok but I would like to understand what's the difference and why it works for me with your example and why not for you.

from python-logstash-async.

eht16 avatar eht16 commented on June 30, 2024

Feel free to open a PR if you are still interested in and re-open this one. Until then, I like to close this issue.

from python-logstash-async.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.