Giter Site home page Giter Site logo

Comments (4)

rfoltyns avatar rfoltyns commented on June 24, 2024 2

@burning-papaya If you haven't made any progress yet, I think that you might be interested in this. What you described is achievable with Log4j2 params and unwrapping serializers.

from log4j2-elasticsearch.

rfoltyns avatar rfoltyns commented on June 24, 2024 1

@burning-papaya I don't see many other options than ThreadContext tbh.

If you're tied to Log4j2 and need to log these events with other appenders, custom MessageFactory and mixins for Message may be a way to go. Otherwise, you can use AsyncBatchDelivery directly and serialize your own classes instead of LogEvent.

from log4j2-elasticsearch.

fire-papaya avatar fire-papaya commented on June 24, 2024

@rfoltyns Thank you, for your reply.

Could you please elaborate on the last sentence (direct usage of AsyncBatchDelivery with my own class)? I have a class which i have to log, every field has to be written in elasticsearch separately for ease of searching (it's Kotlin data class):

@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
 data class RequestLog (
    @JsonProperty("verb") var verb: String = "",
    @JsonProperty("uri") var uri: String = "",
    @JsonProperty("query") var query: String = "",
    @JsonProperty("body") var body: String = "",
    @JsonProperty("io_type") var type: String = "OUT_REQUEST"
)

from log4j2-elasticsearch.

rfoltyns avatar rfoltyns commented on June 24, 2024

You can use parts of programmatic config test and use this library like this:

asyncBatchDelivery.add(indexName, itemSourceFactory.create(instanceOfYourClass, objectWriter));

ItemSourceFactory and AsyncBatchDelivery must be started explicitly in this case.

from log4j2-elasticsearch.

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.