Last active
July 25, 2023 13:46
-
-
Save pvasek/5994a0599e261e08df22b553bde8da4b to your computer and use it in GitHub Desktop.
LOKI Promtail configuration for .NET core with serilog compact format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server: | |
http_listen_port: 9080 | |
grpc_listen_port: 0 | |
positions: | |
filename: /tmp/positions.yaml | |
clients: | |
- url: http://loki:3100/api/prom/push | |
scrape_configs: | |
- job_name: system | |
static_configs: | |
- targets: | |
- localhost | |
labels: | |
__path__: /var/logs/*.log | |
pipeline_stages: | |
- json: | |
timestamp: | |
source: '"@t"' | |
format: RFC3339 | |
labels: | |
level: | |
source: '"@l"' | |
venue: | |
source: "venueId" | |
application: | |
source: "Application" | |
output: | |
source: '{message: "@m", stack: "@x"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello! I have a .net web application and I want to monitorize with grafana. Im using windows, I have the grafana service running and also Loki and Promtail running on terminal. Seems all is running, but I cant send logs with promtail to Loki. I created a logs file where my .net app is writing, I changed the promtail config to read from that log file, but promtail cant communicate to loki through the endpoint http://localhost:3100/loki/api/v1/push. I dont know what is the problem, but I think I'll change the grafana, loki and promtail to be running with docker. Another observation is that I can send a log to loki via curl command, this one:
"curl -v -H "Content-Type: application/json" -XPOST -s "http://localhost:3100/loki/api/v1/push" --data-raw
'{"streams": [{ "stream": { "foo": "bar2" }, "values": [ [ "1570818238000000000", "fizzbuzz" ] ] }]}'".
If I send manually the log I can add a new DataSource in grafana, but with promtail I'm unable. On promtail terminal I got this error: "level=warn ts=2023-07-25T10:00:48.3616291Z caller=client.go:379 component=client host=localhost:3100 msg="error sending batch, will retry" status=-1 error="Post "http://localhost:3100/loki/api/v1/push\": context deadline exceeded"" while he's running.
Do you have any recomendation for me to test?
Best Regards,
Helder