grafana / agent

Vendor-neutral programmable observability pipelines.
https://grafana.com/docs/agent/
Apache License 2.0
1.6k stars 487 forks source link

Grafana Agent v0.24.0 doesn't work with old configuration #1607

Closed hungran closed 2 years ago

hungran commented 2 years ago

I've used the configuration for getting log Windows system as below with v.023.0 and it was running as expected

server:
  http_listen_port: 12345
metrics:
  wal_directory: C:\ProgramData\grafana-agent-wal
  global:
    scrape_interval: 1m
  configs:
    - name: integrations
integrations:
  windows_exporter:
    enabled: true

logs:
  # Choose a directory to save the last read position of log files at.
  # This directory will be created if it doesn't already exist.
  positions_directory: C:\grafana-agent
  configs:
    - name: windows
      # Loki endpoint to push logs to
      clients:
        - url: https://loki.....
      scrape_configs:
        - job_name: windowslogs
          static_configs:
            - targets: [localhost]
              labels:
                app: appname
                node_name: abc
                __path__: C:\Logs\**\Mobile.log

When upgraded to v0.24.0 with the same as above config the Grafana Agent was not run Error message: image

mattdurham commented 2 years ago

I cannot reproduce this but did see something similar while testing the release candidate. It went away after trying to restart it a second time. Can you share/look at the windows event log to see if it indicates why it could not start.

hungran commented 2 years ago

Hi @mattdurham Not so much info here is the log I was received after changed the configuration file to new one

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
 <System>
  <Provider Name="Service Control Manager" Guid="{555908d1a6d7-4695-8e1e-26931d2012f4}" EventSourceName="Service Control Manager" /> 
  <EventID Qualifiers="49152">7034</EventID> 
  <Version>0</Version> 
  <Level>2</Level> 
  <Task>0</Task> 
  <Opcode>0</Opcode> 
  <Keywords>0x8080000000000000</Keywords> 
  <TimeCreated SystemTime="2022-04-13T07:02:24.496069400Z" /> 
  <EventRecordID>45523</EventRecordID> 
  <Correlation /> 
  <Execution ProcessID="956" ThreadID="7948" /> 
  <Channel>System</Channel> 
  <Computer>xxxxxxxx</Computer> 
  <Security /> 
  </System>
- <EventData>
  <Data Name="param1">Grafana Agent</Data> 
  <Data Name="param2">1</Data> 
  <Binary>470072006100660061006E00610020004100670065006E0074000000</Binary> 
  </EventData>
  </Event>
mattdurham commented 2 years ago

If you run as a cmd line does it error?

hungran commented 2 years ago

This was run by PowerShell5.x I used script (PS + WinRM), not sure with CMD Are there any difference between?

mattdurham commented 2 years ago

Found the issue and will be fixed in the next release. You need to add a log_level: info to the configuration.

mattdurham commented 2 years ago

This was fixed already in https://github.com/grafana/agent/commit/3b8d8b9f3a5b1e3a7081559cf0b136b031044e69 and released in v0.24.1; if you download the latest release then you should be able to run the configuration without defining a log level.