Thanks Xuan Gong for put a quick patch and Rohith Sharma K S for quick comments!
I think this patch fix an issue for log rolling correctly and I verified the patch locally and previous test failure is gone.
A couple of comments:
reader creation is duplicated, may be this can be avoided.
This is also my thought when I first look. However, after taking a look again especially sync with Xuan offline, I agree this should be by intentional as reader's stream index could be updated after calling getContainerLogsStream(). However, we should add a comments there to explicitly mention that why we need a "duplicated" creation here or later comer could be confused also and did mistakenly change.
int tailContentSize = "\nEnd of LogType:syslog\n\n".getBytes().length;
This is not right. Here LogType should be stdout but not syslog although not affect result yet.
One optional comments to see if you would like to address here or later: there are many hard coded messages, like: "Hello container_0_0001_01_000003 in stdout!" - better to have static method with specifying container id and logtype.