Git Product home page Git Product logo

Comments (3)

vanattf avatar vanattf commented on June 1, 2024

Hello,

Append logs to an existing file in S3

The selection of the key name in S3 currently takes into account the date/time, host name, and an application-specific ID to avoid name clash and nasty concurrency issues when multiple hosts/processes are appending to the same destination (just imagine two threads writing to a file). There is also a possible performance hit (unless there is an S3 feature to append that I don't know about) of having to download the content of the key, append to it, then upload it back into the same key.
Honestly I can't think of a good solution to these challenges off of the top of my head. Perhaps if you can elaborate on what problem you're trying to solve by having these logs go into a preexisting file, I can try to figure something out.

compress output before storing in S3

This is definitely doable. I will look into it. I believe there is already support in Java for this.

from log4j-s3-search.

toobstar avatar toobstar commented on June 1, 2024

re appending logs, the motivation is mainly to reduce the amount of files that get generated in the bucket. Just googling now it's clear s3 does not support in place file appending so I guess it's not an option. Downloading & overwriting would work but inefficient I guess.

Thanks anyway!

from log4j-s3-search.

vanattf avatar vanattf commented on June 1, 2024

Oh I see what you mean. You can mitigate the number of keys used somewhat by increasing the log4j.appender.S3Appender.stagingBufferSize or log4j.appender.S3Appender.stagingBufferAge.

But it won't solve the problem completely because at some threshold value the buffer will take on too much memory (and the eventual flush/publish will be more risky due to potential of network errors). That may be mitigated further by using local files instead of an in-memory buffer as it does now, but it is still susceptible to loss of content if something goes wrong while uploading a "huge" file to S3. Maybe with compression we can push the envelope a bit more.

So perhaps out of this are two features worth looking into:

  • Using a file in the local file system instead of in-memory buffer. Slightly more cumbersome since now we have to worry about IO errors, but nothing is ever free, is it? :-)
  • Compressing log data

from log4j-s3-search.

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.