Grafana-agent can’t access the logs on windows; *The process cannot access the file because it is being used by another process.*

Hi,
i have installed Grafana-Agent-V0.42.0 on Windows 10 Pro for Workstation

       labels:
          instance: 'xxxx'
          __path__: C:/WINDOWS/system32/config/*
          job: integrations/node_exporter

I did the above configuration but grafana isn’t able to read the log files on windows. In windows event logs I can see that Grafana-agent is trying to read all the log files for not able to read it. It says the process cannot access the file because it is being used by another process. it’s for all the files under /config directory.

What’s causing this, any one can help?

Thats not where windows keeps its log files, that where the registry lives:

%SystemRoot%\System32\config:

  • Sam (HKEY_LOCAL_MACHINE\SAM)
  • Security (HKEY_LOCAL_MACHINE\SECURITY)
  • Software (HKEY_LOCAL_MACHINE\SOFTWARE)
  • System (HKEY_LOCAL_MACHINE\SYSTEM)
  • Default (HKEY_USERS\.DEFAULT)
  • Userdiff (not associated with a hive, used only during upgrades)

Thats why the files are in use, coz the registry hive in in use

Thanks

Which path should I give Grafana-agent to collect the logs?

this works for promtail:

scrape_configs:

  • job_name: Windows_Application_Log
    windows_events:
    use_incoming_timestamp: false
    bookmark_path: “./Windows_Application_Log.xml”
    eventlog_name: “Application”
    xpath_query: ‘*’
    labels:
    host: ${OriginalComputerName}
    job: Windows_Application_Log
    env: Development
    platform: Windows
1 Like