When i try to add loki in grafana, i get the following error when pressing “save & test”: “Unable to fetch labels from Loki (Failed to call resource), please check the server logs for more details”
Btw, the content of the following file is actually from the logfile on a remote server via promtail, so its actually connected …wow… C:\Program Files\GrafanaLabs!Loki\tmp\loki\wal\00000000
Also, right before i created this post, i deleted the whole tmp folder, and it populated it.
#LOKI conf
auth_enabled: false
server:
http_listen_port: 3100
#log_level: debug
grpc_listen_port: 9096
common:
path_prefix: ./tmp/loki/
storage:
filesystem:
chunks_directory: ./tmp/loki/chunks
rules_directory: ./tmp/loki/rules
replication_factor: 1
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory
#query_range:
# results_cache:
# cache:
# embedded_cache:
# enabled: true
# distributed: false
# max_size_mb: 100
schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
ruler:
alertmanager_url: http://localhost:9093
# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
#
# Statistics help us better understand how Loki is used, and they show us performance
# levels for most users. This helps us prioritize features and documentation.
# For more information on what's sent, look at
# https://github.com/grafana/loki/blob/main/pkg/usagestats/stats.go
# Refer to the buildReport method to see what goes into a report.
#
# If you would like to disable reporting, uncomment the following lines:
#analytics:
# reporting_enabled: false
I can also add that on the same remote server running promtail, i have also “windows_exporter” installed on that server. windows_exporter sends data to prometheus(local pc, same as loki and grafana).
Just because you see folders in loki does not necessarily mean things are working. You have to do actual tests.
I think the above is where your issue is. Notice what doco says about Promtail
Promtail is an agent which ships the contents of local logs to a private Grafana Loki instance or Grafana Cloud. It is usually deployed to every machine that has applications needed to be monitored.
It is a push system. Cause I do not see anything in your Loki config, I have know to be blind often, that points to Promtail.
in the following folder, i found files with actual log data from the server, so thats why i know it fetches data: C:\Program Files\GrafanaLabs!Loki\tmp\loki\wal\00000000
yep, the graphics you posted seems fair. I have grafana and loki on same pc, and promtail on another server.
promtail config:
#promtail config
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: C:\Users\****\AppData\Local\Temp\positions.yaml
clients:
- url: http://*********:3100/loki/api/v1/push
# The URL where Loki is listening, denoted in Loki as http_listen_address and
# http_listen_port. If Loki is running in microservices mode, this is the HTTP
# URL for the Distributor. Path to the push API needs to be included.
# Example: http://example.com:3100/loki/api/v1/push
scrape_configs:
- job_name: *******-Logs
static_configs:
# Configures the discovery to look on the current machine.
# This is required by the prometheus service discovery code but doesn't
# really apply to Promtail which can ONLY look at files on the local machine
# As such it should only have the value of localhost, OR it can be excluded
# entirely and a default value of localhost will be applied by Promtail.
- targets:
- localhost
labels:
job: varlogs
# The path to load logs from. Can use glob patterns (e.g., /var/log/*.log).
__path__: F:\*********\standalone\log\*.log
# Additional labels to assign to the logs
# [ <labelname>: <labelvalue> ... ]