New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
log-vm: To centralize logs using grafana promtail & loki #594
base: main
Are you sure you want to change the base?
Conversation
* Design https://ssrc.atlassian.net/wiki/x/GYA4Pw * log-vm scaffolding based on copy of net-vm - sets up systemd-journal-remote on default port 19532 Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Vunny Sodhi <vunny.sodhi@unikie.com>
This patch will add promtail-agent service in `ghaf-host` and `gui-vm`. Also add loki service in log-vm. Signed-off-by: Vunny Sodhi <vunny.sodhi@unikie.com>
Signed-off-by: Vunny Sodhi <vunny.sodhi@unikie.com>
Better link testing instructions for grafana installation to https://nixos.wiki/wiki/Grafana instead of https://community.grafana.com/t/installing-on-nixos/6712
I got grafana running with:
|
This patch adds hostName as parameter in promtail agent so that we can distinguish from which machine or vm logs are coming. Signed-off-by: Vunny Sodhi <vunny.sodhi@unikie.com>
Thanks @vilvo for details, I have updated |
Also, please change step 3. in Testing section instructions to:
As of now, it's unclear where the tester is expected to run the command. Also, it's better use grafana instance ip address instead of localhost. Tested it to work that way. Also, the ghaf logs filtering based on the ghaf hostname works fine 👍🏻 |
Description of changes
Checklist for things done
x86_64
aarch64
riscv64
nix flake check --accept-flake-config
and it passesTesting
To view logs in locally on ghaf target machine
ssh into log-vm and use
logcli
to view systemd journal logsTo view logs in grafana GUI on remote server/ dev machine.
grafana
To install grafana on NixOS you can follow mentioned guide here
Example:
Make sure you have connected to WIFI using
nm-launcher
onghaf target
machine.Run the below command to add
loki
data source, replace withnetvm-wifi-ip-address
with yours IP.[ghaf@log-vm:~]$ curl 'http://admin:admin@<grafana_ip_in_your_local_network>:3000/api/datasources'
-X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"loki","type":"loki","url":"http://<net-vm_wifi_ip_address>:3100","access":"proxy","isDefault":true,"database":"tsdb"}'
Go to browser where you want to view the logs and type following address
http://<grafana_ip_in_your_local_network>:3000/explore
Follow below steps in order to view logs/download logs.
Also there is way to filter out logs based on hostName as in example below:
Next Steps