microsoft / windows-container-tools

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

Fix 30 seconds delay issue #156

Closed CharityKathure closed 1 year ago

CharityKathure commented 1 year ago

Description

The container output is 30 seconds behind the contents of the file 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, therefore making viewing the logs and troubleshooting confusing and very difficult.

image

Change/ Fix

Reduce waitable time from 30 seconds

Testing

ContainerLog | where ContainerID in ('58b89a9a51a97a77cb9e0bcf5326ce326bcfc422cf96655fc5fced1374f2e73f') | extend LoglineEntry = parse_json(LogEntry) | extend LogEntryDetails = parse_json(LoglineEntry.LogEntry) | extend LogSource = LoglineEntry.Source | extend InFileDate = case(LogSource contains "File", todatetime(substring(LogEntryDetails.Logline, 0, 19)), LogEntryDetails.Time) | project LogSource, TimeGenerated, InFileDate, TimeDifference = toint(datetime_diff('second',TimeGenerated, InFileDate)), LogEntryDetails, LogEntry | where InFileDate != "" and LogSource contains "File" | distinct TimeGenerated, InFileDate;

Testing Results: Log analytics timestamp shows no delay image