Grafana Agent is currently not able to access when I compose-up

Currently I have setup the Grafana Agent through Docker, unfortunately I can’t open the host. It said unavailable. I need to use Grafana Agent to collect logs and the push to the Grafana Loki


image

Agent.yaml
server:
log_level: info

metrics:
global:
scrape_interval: 1m
configs:
- name: test
host_filter: false
scrape_configs:
- job_name: local_scrape
static_configs:
- targets: [‘127.0.0.1:12345’]
labels:
cluster: ‘localhost’
remote_write:
- url: http://localhost:9009/api/prom/push

Grafana agent by default runs on local interface 127.0.0.1, so you cannot access that on host machine,

you can update your config to include --server.http.address=0.0.0.0:12345 listen on all interface so that you can access it on host machine.