Skip to content

Instantly share code, notes, and snippets.

@hamidrhashmi
Created January 3, 2024 06:33
Show Gist options
  • Save hamidrhashmi/ababa2ade30ba694979e1a4b3626ccdd to your computer and use it in GitHub Desktop.
Save hamidrhashmi/ababa2ade30ba694979e1a4b3626ccdd to your computer and use it in GitHub Desktop.
How to configure grafana agent to send logs

Go to Grafana agent git repo, and download the altest release or use the following command to download for Debian

wget https://github.com/grafana/agent/releases/download/v0.38.1/grafana-agent-0.38.1-1.amd64.deb

instal the agent

dpkg -i grafana-agent-0.38.1-1.amd64.deb

Edit grafana-agent configuration file /etc/grafana-agent.yaml

loki:
  configs:
  - name: default
    positions:
      filename: /tmp/positions.yaml
    scrape_configs:
      - job_name: varlogs
        static_configs:
          - targets: [localhost]
            labels:
              job: varlogs
              __path__: /var/log/*log
      - job_name: freeswitch
        static_configs:
          - targets: [localhost]
            labels:
              job: fslogs
              __path__: /home/hrhashmi/FREESWITCH/var/log/freeswitch/freeswitch.log
    clients:
      - url: http://qryn.hbvoice.local:3100/loki/api/v1/push
        basic_auth:
          username: default
          password: clickpass

Start grafana-agent

systemctl start grafana-agent

Enjoy ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment