microsoft / windows-container-tools

Collection of tools to improve the Windows Containers experience
MIT License
240 stars 68 forks source link

[BUG] 30 second delay #127

Closed scosenscap closed 1 year ago

scosenscap commented 1 year ago

I'm using LogMonitor to monitor a single file, client.log, in a directory, running in a container orchestrated by Kubernetes, in Azure.

The application that the container runs will output roughly 2 lines to client.log every second when idling and potentially thousands of lines every second when active, and keep an open handle to the file at all times.

I'm finding the container output will be up to 30 seconds behind the contents of the file. This observable when comparing the log file entry timestamp from inside the file (right hand column of ss) and the timestamp from the container output log (left hand column):

Screenshot 2023-03-06 170021

I've also noticed that if I connect into the running container, and run a get-content over the file, the container logs immediately catch up, but will then go back to waiting 30 seconds. If I do a get-content -wait on the file, the container logs steam real-time.

This is causing problems when viewing the container output through Azure Log Analytics, as Log Analytics gets an inaccurate "Time-Generated" timestamp, making ordering in Log Analytics wrong, making viewing the logs and troubleshooting confusing and very difficult.

Is this a configurable option, or a known issue, and is there a solution or workaround?

Thanks.

iankingori commented 1 year ago

@scosenscap what version of Log Monitor are you using?

scosenscap commented 1 year ago

@iankingori 1.2.1.0