When I restart the Alloy service, it also gives me this error:
ts=YYYY-MM-DDT00:00:00.0000000Z level=error source=[MASKED_SOURCE_PATH] msg=“failed to set GOMEMLIMIT” package=[MASKED_PACKAGE] error=“failed to set GOMEMLIMIT: cgroups is not supported on this system”
I’ve observed that when the “file already closed” error occurs, the log file was writing approximately 54,000 lines of logs within a few seconds.
Can any experts advise on how to resolve these issues? Specifically:
How can I prevent the “file already closed” error, especially during high-volume logging?
Is the GOMEMLIMIT error significant, and if so, how can it be addressed on a Windows system?
There are some tuning configurations in loki.write under the WAL section (see loki.write | Grafana Alloy documentation), but I am not sure if you can configure readline_rate in Alloy.
Tony, thank you so much for answering!
Do you have any best practice configuration as an example? The problem here is that the flow is testing environment is not the same as in production environment, I can’t reproduce it.
I don’t mind updating the alloy version to 1.7.1 in prod and give it a try.
I think your problem is more likely to be memory related than anything else. I don’t use Windows, but from my experience on Linux 54000 lines of logs in a few seconds shouldn’t be particularly taxing for log agents.
I don’t really tune alloy agents, I do sometimes configure a backoff settings, but I don’t think that would help in this case.
what are the specs on this windows server: ram, windows version?
Are there other software installed on this windows server, what is this server used for: AD, DHCP, SQL server, domain controller? What logs are you pushing from it?
do you have other windows servers that also have alloy or just this one?
I am rolling out grafana alloy onto all the windows 2019 application servers, and yes, there are software installed on the boxes. the box that I am having GOMEMLIMIT problem with has 32GB ram, and the average memory usage on the box is usually 40%. Never go beyond 50%. Plenty of diskspaces, and well below 11% CPU usage all the time. As for the log, its just plain text log file output by an in-house application running as a service.
it seems like some have resolved this by upgrading, you could try that in one of your servers
maybe you have seen this one
also is it just one file per server for this application? is it somethin that can be configured to be pushed to a centralized location like a dedicated alloy server?
Hello Yosiasz,
I am planning to upgrade the box with the latest Alloy version v1.7.1
As for your 2nd question , the answer is no, there are other files for this application.
When you say alloy server, you mean Loki server right? I think the Loki server that we have can coupe with huge amount of data, I don’t think configuring a dedicated Loki server would help as the Grafana agent works without any issue.
i was thinking of a dedicated log file/alloy server. All windows servers push their files to this server and alloy pushes logs to Loki. or some other architect…
Over the weekend, I have upgraded the alloy version to v1.7.4
however, I am still seeing the same issue, do we have more tooling for debugging in this version?
let me closely monitoring that for a few days and see if there is any behavioral changes in the latest version.
The “file already closed” error likely occurs due to rapid log rotation or file locking issues. Try increasing the max_wait and min_backoff settings in your Alloy configuration to give the tailer more time to handle file changes. Also, ensure no other processes (like antivirus scans) are interfering with the log files.
The GOMEMLIMIT error isn’t critical on Windows, as cgroups aren’t natively supported. You can ignore it or try setting GOMEMLIMIT=0 as an environment variable to suppress the warning.