Skip to content

Commit bd50e97

Browse files
authored
docs: update public readme (#214)
This readme will be displayed on the plugin page on the marketplace. Hence, I'm removing most of the unrelated technical information. And adding more information on how to use the plugin instead.
1 parent 6e5b97b commit bd50e97

File tree

7 files changed

+41
-244
lines changed

7 files changed

+41
-244
lines changed

src/README.md

Lines changed: 41 additions & 244 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,31 @@
11
# VictoriaLogs datasource for Grafana
2-
The VictoriaLogs Grafana plugin is a datasource plugin that enables Grafana to query, visualize,
3-
and interact with log data stored in VictoriaLogs, a high-performance log storage
4-
and processing system.
2+
3+
The VictoriaLogs Grafana plugin allows Grafana to query, visualize,
4+
and interact with [VictoriaLogs](https://docs.victoriametrics.com/victorialogs),
5+
a high-performance log storage and processing system.
6+
7+
![dashboard.png](img/dashboard.png)
58

69
## Capabilities
710

8-
1. Query Logs with Grafana.
9-
1. Use the plugin to fetch logs stored in VictoriaLogs and display them in Grafana dashboards by
10-
querying using the VictoriaLogs Query Language ([LogsQL](https://docs.victoriametrics.com/victorialogs/logsql/)).
1111
1. Use [LogsQL](https://docs.victoriametrics.com/victorialogs/logsql/) to filter, aggregate, and transform logs data to gain insights into application behavior.
12-
1. Show live-streaming logs in Grafana.
13-
14-
## Installation
12+
1. Use Explore mode with Grafana.
13+
1. Show live-streaming logs.
14+
1. Build dashboards and setup alerts.
15+
1. Use Ad Hoc filters.
1516

16-
Installing VictoriaLogs datasource
17-
[requires](https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#allow_loading_unsigned_plugins)
18-
the following changes to Grafana's `grafana.ini` config:
17+
Try it at [VictoriaMetrics playground](https://play-grafana.victoriametrics.com/d/be5zidev72m80f/k8s-logs-demo)!
1918

20-
``` ini
21-
[plugins]
22-
allow_loading_unsigned_plugins = victoriametrics-logs-datasource
23-
```
19+
## Installation
2420

25-
If using `grafana-operator`, adjust `config` section in your `kind=Grafana` resource as below:
21+
For detailed instructions on how to install the plugin on Grafana Cloud or locally, please checkout the [Plugin installation docs](https://grafana.com/docs/grafana/latest/plugins/installation/).
2622

27-
```
28-
config:
29-
plugins:
30-
allow_loading_unsigned_plugins: "victoriametrics-logs-datasource"
31-
```
23+
### Manual configuration via UI
3224

33-
For detailed instructions on how to install the plugin in Grafana Cloud or locally,
34-
please checkout the [Plugin installation docs](https://grafana.com/docs/grafana/latest/plugins/installation/).
25+
Once the plugin is installed on your Grafana instance, follow [these instructions](https://grafana.com/docs/grafana/latest/datasources/add-a-data-source/)
26+
to add a new VictoriaLogs data source, and enter configuration options.
3527

36-
### Grafana Provisioning
28+
### Configuration via file
3729

3830
Provisioning of Grafana plugin requires creating [datasource config file](http://docs.grafana.org/administration/provisioning/#datasources):
3931

@@ -56,243 +48,48 @@ datasources:
5648
isDefault: true
5749
```
5850
59-
Please find the example of provisioning Grafana instance with VictoriaLogs datasource below:
60-
61-
1. Create a file at `./provisioning/datasources/vm.yml` with datasource example file.
62-
63-
1. Define Grafana installation via docker-compose:
64-
65-
```yaml
66-
version: '3.0'
67-
services:
68-
grafana:
69-
image: grafana/grafana:11.0.0
70-
environment:
71-
- GF_INSTALL_PLUGINS=https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/v0.13.1/victoriametrics-logs-datasource-v0.13.1.zip;victoriametrics-logs-datasource
72-
- GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=victoriametrics-logs-datasource
73-
ports:
74-
- 3000:3000/tcp
75-
volumes:
76-
- ./provisioning:/etc/grafana/provisioning
77-
```
78-
79-
1. Run docker-compose file:
80-
81-
```
82-
docker-compose -f docker-compose.yaml up
83-
```
84-
85-
After Grafana starts successfully, datasource should be available in the datasources tab
86-
87-
![Configuration](https://raw.githubusercontent.com/VictoriaMetrics/victorialogs-datasource/refs/heads/main/docs/assets/provision_datasources.webp)
88-
89-
### Install in Kubernetes
90-
91-
#### Grafana helm chart
92-
93-
Example with Grafana [helm chart](https://github.com/grafana/helm-charts/blob/main/charts/grafana/README.md):
94-
95-
Option 1. Using Grafana provisioning:
96-
97-
``` yaml
98-
env:
99-
GF_INSTALL_PLUGINS: "https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/v0.13.1/victoriametrics-logs-datasource-v0.13.1.zip;victoriametrics-logs-datasource"
100-
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: "victoriametrics-logs-datasource"
101-
```
102-
103-
Option 2. Using Grafana plugins section in `values.yaml`:
104-
105-
``` yaml
106-
plugins:
107-
- https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/v0.13.1/victoriametrics-logs-datasource-v0.13.1.zip;victoriametrics-logs-datasource
108-
```
109-
110-
Option 3. Using init container:
111-
112-
``` yaml
113-
extraInitContainers:
114-
- name: "load-vm-ds-plugin"
115-
image: "curlimages/curl:7.85.0"
116-
command: [ "/bin/sh" ]
117-
workingDir: "/var/lib/grafana"
118-
securityContext:
119-
runAsUser: 472
120-
runAsNonRoot: true
121-
runAsGroup: 472
122-
args:
123-
- "-c"
124-
- |
125-
set -ex
126-
mkdir -p /var/lib/grafana/plugins/
127-
ver=$(curl -s -L https://api.github.com/repos/VictoriaMetrics/victorialogs-datasource/releases/latest | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1)
128-
curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/$ver/victoriametrics-logs-datasource-$ver.tar.gz -o /var/lib/grafana/plugins/vl-plugin.tar.gz
129-
tar -xf /var/lib/grafana/plugins/vl-plugin.tar.gz -C /var/lib/grafana/plugins/
130-
rm /var/lib/grafana/plugins/vl-plugin.tar.gz
131-
volumeMounts:
132-
# For grafana-operator users, change `name: storage` to `name: grafana-data`
133-
- name: storage
134-
mountPath: /var/lib/grafana
135-
```
136-
137-
For `grafana-operator` users, the above configuration should be done for the part `/spec/deployment/spec/template/spec/initContainers` of your `kind=Grafana` resource.
138-
139-
This example uses init container to download and install plugin. To allow Grafana using this container as a sidecar set the following config:
140-
141-
```yaml
142-
sidecar:
143-
datasources:
144-
initDatasources: true
145-
enabled: true
146-
```
147-
148-
See more about chart settings [here](https://github.com/grafana/helm-charts/blob/541d97051de87a309362e02d08741ffc868cfcd6/charts/grafana/values.yaml)
149-
150-
Option 4. would be to build custom Grafana image with plugin based on same installation instructions.
151-
152-
#### Grafana operator
153-
154-
Example with Grafana [operator](https://github.com/grafana-operator/grafana-operator):
155-
156-
```yaml
157-
apiVersion: grafana.integreatly.org/v1beta1
158-
kind: Grafana
159-
metadata:
160-
name: grafana-vm
161-
spec:
162-
persistentVolumeClaim:
163-
spec:
164-
accessModes:
165-
- ReadWriteOnce
166-
resources:
167-
requests:
168-
storage: 200Mi
169-
deployment:
170-
spec:
171-
template:
172-
spec:
173-
initContainers:
174-
- name: "load-vm-ds-plugin"
175-
image: "curlimages/curl:7.85.0"
176-
command: [ "/bin/sh" ]
177-
workingDir: "/var/lib/grafana"
178-
securityContext:
179-
runAsUser: 472
180-
runAsNonRoot: true
181-
runAsGroup: 472
182-
args:
183-
- "-c"
184-
- |
185-
set -ex
186-
mkdir -p /var/lib/grafana/plugins/
187-
ver=$(curl -s https://api.github.com/repos/VictoriaMetrics/victorialogs-datasource/releases/latest | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1)
188-
curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/$ver/victoriametrics-logs-datasource-$ver.tar.gz -o /var/lib/grafana/plugins/vl-plugin.tar.gz
189-
tar -xf /var/lib/grafana/plugins/vl-plugin.tar.gz -C /var/lib/grafana/plugins/
190-
rm /var/lib/grafana/plugins/vl-plugin.tar.gz
191-
volumeMounts:
192-
- name: grafana-data
193-
mountPath: /var/lib/grafana
194-
config:
195-
plugins:
196-
allow_loading_unsigned_plugins: victoriametrics-logs-datasource
197-
```
198-
199-
See [Grafana operator reference](https://grafana-operator.github.io/grafana-operator/docs/grafana) to find more about Grafana operator.
200-
This example uses init container to download and install plugin.
201-
202-
### Dev release installation
203-
204-
1. To download plugin build and move contents into Grafana plugins directory:
205-
206-
``` sh
207-
ver=$(curl -s https://api.github.com/repos/VictoriaMetrics/victorialogs-datasource/releases/latest | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1)
208-
curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/$ver/victoriametrics-logs-datasource-$ver.tar.gz -o /var/lib/grafana/plugins/vl-plugin.tar.gz
209-
tar -xf /var/lib/grafana/plugins/vl-plugin.tar.gz -C /var/lib/grafana/plugins/
210-
rm /var/lib/grafana/plugins/vl-plugin.tar.gz
211-
```
212-
213-
1. Restart Grafana
214-
215-
## Getting started development
216-
217-
### 1. Configure Grafana
218-
219-
Installing dev version of Grafana plugin requires to change `grafana.ini` config to allow loading unsigned plugins:
220-
221-
``` ini
222-
# Directory where Grafana will automatically scan and look for plugins
223-
plugins = {{path to directory with plugin}}
224-
```
225-
226-
``` ini
227-
[plugins]
228-
allow_loading_unsigned_plugins = victoriametrics-logs-datasource
229-
```
230-
231-
### 2. Run the plugin
232-
233-
In the project directory, you can run:
234-
235-
```sh
236-
# install dependencies
237-
yarn install
238-
239-
# run the app in the development mode
240-
yarn dev
51+
## Building queries
24152
242-
# build the plugin for production to the `victoriametrics-logs-datasource` folder and zip build
243-
yarn build:zip
244-
```
245-
246-
### 3. How to build backend plugin
53+
VictoriaLogs query language is [LogsQL](https://docs.victoriametrics.com/victorialogs/logsql/).
54+
Queries can be built using raw LogsQL or via QueryBuilder.
24755
248-
From the root folder of the project run the following command:
56+
See panels examples at [VictoriaMetrics playground](https://play-grafana.victoriametrics.com/d/be5zidev72m80f/k8s-logs-demo)
57+
and LogsQL examples [here](https://docs.victoriametrics.com/victorialogs/logsql-examples/).
24958
250-
```
251-
make vl-backend-plugin-build
252-
```
25359
254-
This command will build executable multi-platform files to the `victoriametrics-logs-datasource` folder for the following platforms:
60+
### Logs panel
25561
256-
* linux/amd64
257-
* linux/arm64
258-
* linux/arm
259-
* linux/386
260-
* amd64
261-
* arm64
262-
* windows
62+
For using [Logs panel](https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/logs/)
63+
switch to `Raw Logs` query type:
26364

264-
### 4.How to build frontend plugin
65+
![panel_logs.png](img/panel_logs.png)
26566

266-
From the root folder of the project run the following command:
67+
### Time series panel
26768

268-
```
269-
make vl-frontend-plugin-build
270-
```
69+
For using [Time series panel](https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/time-series/)
70+
switch to `Range` query type:
27171

272-
This command will build all frontend app into `victoriametrics-logs-datasource` folder.
72+
![panel_time_series.png](img/panel_time_series.png)
27373

274-
### 5. How to build frontend and backend parts of the plugin:
74+
### Stats panel
27575

276-
When frontend and backend parts of the plugin is required, run the following command from the root folder of the project:
76+
For using [Stats panel](https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/stat/)
77+
switch to `Instant` query type:
27778

278-
```
279-
make vl-plugin-build
280-
```
79+
![panel_stat.png](img/panel_stat.png)
28180

282-
This command will build frontend part and backend part or the plugin and locate both parts into `victoriametrics-logs-datasource` folder.
81+
For enabling background visualization switch to `Range` query type.
28382

284-
## How to make new release
83+
### Table panel
28584

286-
1. Make sure there are no open security issues.
287-
1. Change version in package.json in a `main` branch
288-
1. Trigger [release pipeline](https://github.com/VictoriaMetrics/victorialogs-datasource/actions/workflows/release.yaml).
289-
1. Go to [releases page](https://github.com/VictoriaMetrics/victorialogs-datasource/releases) once pipeline is finished and verify release with the name `TAG` has been created and has all the needed binaries and checksums attached.
85+
For using [Table panel](https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/table/)
86+
switch to `Raw Logs` query type:
29087

291-
## Notes
88+
![panel_table.png](img/panel_table.png)
29289

293-
In the `plugin.json` file of our plugin, the `metrics` field is set to `true`. This is not to support metric queries in the classical sense but to ensure our plugin can be selected in the Grafana panel editor.
90+
And apply `Transformations` by labels:
29491

295-
For more information on the fields in `plugin.json`, please refer to the [Grafana documentation](https://grafana.com/developers/plugin-tools/reference-plugin-json#properties).
92+
![panel_table_transformation.png](img/panel_table_transformation.png)
29693

29794
## License
29895

src/img/dashboard.png

-228 KB
Loading

src/img/panel_logs.png

40 KB
Loading

src/img/panel_stat.png

32.2 KB
Loading

src/img/panel_table.png

25.9 KB
Loading
21.1 KB
Loading

src/img/panel_time_series.png

38.5 KB
Loading

0 commit comments

Comments
 (0)