amazon-kinesis-agent icon indicating copy to clipboard operation
amazon-kinesis-agent copied to clipboard

How kinesis-agent does handle logrotation rename?

Open timesking opened this issue 6 years ago • 0 comments

Hi,

I can't find any documentation about how kinesis-agent handles logratation renames. For example, I'm using Log4j2 2.11.0. with RollingFileAppender and fileIndex attribute is set to "max" by default. So, the logroation behavior should be:

Number of rollovers Active output target Archived log files Description
0 foo.log - All logging is going to the initial file.
1 foo.log foo-1.log During the first rollover foo.log is renamed to foo-1.log. A new foo.log file is created and starts being written to.
2 foo.log foo-1.log, foo-2.log During the second rollover foo.log is renamed to foo-2.log. A new foo.log file is created and starts being written to.
3 foo.log foo-1.log, foo-2.log, foo-3.log During the third rollover foo.log is renamed to foo-3.log. A new foo.log file is created and starts being written to.

The agent.json looks like:

{
      "filePattern": "/mnt/app/logs/rolling/foo*.log",
      "kinesisStream": "foo-stream",
      "partitionKeyOption": "RANDOM"
    },

My question is: When foo changed name to foo-1, did our agent send all logs in foo-1 again, which I tought all of logs should has been sent when its name is foo.

timesking avatar Sep 17 '18 17:09 timesking