{"id":8526845,"url":"https://github.com/VictoriaMetrics/victorialogs-datasource","last_synced_at":"2025-08-02T16:32:08.086Z","repository":{"id":221167003,"uuid":"741982763","full_name":"VictoriaMetrics/victorialogs-datasource","owner":"VictoriaMetrics","description":"Grafana datasource for VictoriaLogs","archived":false,"fork":false,"pushed_at":"2024-12-03T14:12:47.000Z","size":1218,"stargazers_count":96,"open_issues_count":23,"forks_count":5,"subscribers_count":12,"default_branch":"main","last_synced_at":"2024-12-03T14:19:23.823Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VictoriaMetrics.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-11T14:15:55.000Z","updated_at":"2024-12-03T14:14:11.000Z","dependencies_parsed_at":"2024-02-23T10:25:33.092Z","dependency_job_id":"fca2f29c-3dff-4a49-b228-d73a346336b7","html_url":"https://github.com/VictoriaMetrics/victorialogs-datasource","commit_stats":null,"previous_names":["victoriametrics/grafana-logs-datasource","victoriametrics/victorialogs-datasource"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictoriaMetrics%2Fvictorialogs-datasource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictoriaMetrics%2Fvictorialogs-datasource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictoriaMetrics%2Fvictorialogs-datasource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictoriaMetrics%2Fvictorialogs-datasource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VictoriaMetrics","download_url":"https://codeload.github.com/VictoriaMetrics/victorialogs-datasource/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228494642,"owners_count":17929159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-04-24T07:15:20.203Z","updated_at":"2025-08-02T16:32:08.012Z","avatar_url":"https://github.com/VictoriaMetrics.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# VictoriaLogs datasource for Grafana\n\nThe VictoriaLogs datasource plugin allows you to query and visualize\n[VictoriaLogs](https://docs.victoriametrics.com/victorialogs/) data in [Grafana](https://grafana.com).\n\n* [Installation](#installation)\n* [Getting started development](#getting-started-development)\n* [How to make new release](#how-to-make-new-release)\n* [Notes](#notes)\n* [License](#license)\n\n## Installation\n\nFor detailed instructions on how to install the plugin in Grafana Cloud or locally,\nplease checkout the [Plugin installation docs](https://grafana.com/docs/grafana/latest/plugins/installation/).\n\n### Install via Docker\n\nTo install plugin via Grafana docker container [specify](https://grafana.com/docs/grafana/latest/setup-grafana/configure-docker/#build-a-grafana-docker-image-with-pre-installed-plugins)\n`GF_INSTALL_PLUGINS=victoriametrics-logs-datasource` environment variable. It will pre-install the plugin on container start.\nSee more details at [Configure a Grafana Docker image](https://grafana.com/docs/grafana/latest/setup-grafana/configure-docker/).\n\n### Grafana Provisioning\n\nProvisioning of Grafana plugin requires creating [datasource config file](http://docs.grafana.org/administration/provisioning/#datasources):\n\n```yaml\napiVersion: 1\ndatasources:\n    # \u003cstring, required\u003e Name of the VictoriaLogs datasource\n    # displayed in Grafana panels and queries.\n  - name: VictoriaLogs\n    # \u003cstring, required\u003e Sets the data source type.\n    type: victoriametrics-logs-datasource\n    # \u003cstring, required\u003e Sets the access mode, either\n    # proxy or direct (Server or Browser in the UI).\n    access: proxy\n    # \u003cstring\u003e Sets URL for sending queries to VictoriaLogs server.\n    # see https://docs.victoriametrics.com/victorialogs/querying/\n    url: http://victorialogs:9428\n    # \u003cstring\u003e Sets the pre-selected datasource for new panels.\n    # You can set only one default data source per organization.\n    isDefault: true\n```\n\nPlease find the example of provisioning Grafana instance with VictoriaLogs datasource below:\n\n1. Create a file at `./provisioning/datasources/vm.yml` with datasource example file.\n\n1. Define Grafana installation via docker-compose:\n\n   ```yaml\n    version: '3.0'\n    services:\n       grafana:\n         image: grafana/grafana:11.0.0\n         environment:\n         - GF_INSTALL_PLUGINS=victoriametrics-logs-datasource\n         ports:\n         - 3000:3000/tcp\n         volumes:\n         - ./provisioning:/etc/grafana/provisioning\n   ```\n\n1. Run docker-compose file:\n\n```\ndocker-compose -f docker-compose.yaml up\n```\n\nAfter Grafana starts successfully, datasource should be available in the datasources tab\n\n![Configuration](docs/assets/provision_datasources.webp)\n\n### Install in Kubernetes\n\n#### Grafana helm chart\n\nExample with Grafana [helm chart](https://github.com/grafana/helm-charts/blob/main/charts/grafana/README.md):\n\nOption 1. Using Grafana provisioning:\n\n``` yaml\nenv:\n  GF_INSTALL_PLUGINS: \"victoriametrics-logs-datasource\"\n```\n\nOption 2. Using Grafana plugins section in `values.yaml`:\n\n``` yaml\nplugins:\n  - victoriametrics-logs-datasource\n```\n\nOption 3. Using init container:\n\n``` yaml\nextraInitContainers:\n  - name: \"load-vm-ds-plugin\"\n    image: \"curlimages/curl:7.85.0\"\n    command: [ \"/bin/sh\" ]\n    workingDir: \"/var/lib/grafana\"\n    securityContext:\n      runAsUser: 472\n      runAsNonRoot: true\n      runAsGroup: 472\n    args:\n     - \"-c\"\n     - |\n       set -ex\n       mkdir -p /var/lib/grafana/plugins/\n       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)\n       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\n       tar -xf /var/lib/grafana/plugins/vl-plugin.tar.gz -C /var/lib/grafana/plugins/\n       rm /var/lib/grafana/plugins/vl-plugin.tar.gz\n    volumeMounts:\n      # For grafana-operator users, change `name: storage` to `name: grafana-data`\n      - name: storage\n        mountPath: /var/lib/grafana\n```\n\nFor `grafana-operator` users, the above configuration should be done for the part `/spec/deployment/spec/template/spec/initContainers` of your `kind=Grafana` resource.\n\nThis example uses init container to download and install plugin. To allow Grafana using this container as a sidecar set the following config:\n\n```yaml\nsidecar:\n  datasources:\n    initDatasources: true\n    enabled: true\n```\n\nSee more about chart settings [here](https://github.com/grafana/helm-charts/blob/541d97051de87a309362e02d08741ffc868cfcd6/charts/grafana/values.yaml)\n\nOption 4. would be to build custom Grafana image with plugin based on same installation instructions.\n\n#### Grafana operator\n\nExample with Grafana [operator](https://github.com/grafana-operator/grafana-operator):\n\n```yaml\napiVersion: grafana.integreatly.org/v1beta1\nkind: Grafana\nmetadata:\n  name: grafana-vm\n  labels:\n     dashboards: grafana\nspec:\n  persistentVolumeClaim:\n    spec:\n      accessModes:\n        - ReadWriteOnce\n      resources:\n        requests:\n          storage: 200Mi\n  deployment:\n    spec:\n      template:\n        spec:\n          initContainers:\n            - name: \"load-vm-ds-plugin\"\n              image: \"curlimages/curl:7.85.0\"\n              command: [ \"/bin/sh\" ]\n              workingDir: \"/var/lib/grafana\"\n              securityContext:\n                runAsUser: 472 \n                runAsNonRoot: true\n                runAsGroup: 472 \n              args:\n                - \"-c\"\n                - |\n                  set -ex\n                  mkdir -p /var/lib/grafana/plugins/\n                  ver=$(curl -s https://api.github.com/repos/VictoriaMetrics/victorialogs-datasource/releases/latest | grep -oE 'v[0-9]+\\.[0-9]+\\.[0-9]+' | head -1)\n                  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\n                  tar -xf /var/lib/grafana/plugins/vl-plugin.tar.gz -C /var/lib/grafana/plugins/\n                  rm /var/lib/grafana/plugins/vl-plugin.tar.gz\n              volumeMounts:\n                - name: grafana-data\n                  mountPath: /var/lib/grafana\n```\n\nSee [Grafana operator reference](https://grafana.github.io/grafana-operator/docs/grafana/) to find more about Grafana operator.\nThis example uses init container to download and install plugin.\n\nIt is also possible to request plugin at `GrafanaDatasource` or `GrafanaDashboard` CRDs.\nFor example:\n```yaml\napiVersion: grafana.integreatly.org/v1beta1\nkind: GrafanaDatasource\nmetadata:\n  name: vl-datasource\nspec:\n  datasource:\n    access: proxy\n    type: victoriametrics-logs-datasource\n    name: VL\n    url: http://victoria-logs-single-server.monitoring.svc.cluster.local:9428\n  instanceSelector:\n    matchLabels:\n      dashboards: grafana\n  plugins:\n    - name: victoriametrics-logs-datasource\n      version: \"0.16.3\"\n---\napiVersion: grafana.integreatly.org/v1beta1\nkind: GrafanaDashboard\nmetadata:\n  name: vl-dashboard\nspec:\n  resyncPeriod: 30s\n  plugins:\n    - name: victoriametrics-logs-datasource\n      version: \"0.16.3\"\n  instanceSelector:\n    matchLabels:\n      dashboards: \"grafana\"\n  json: |\n     {\n        \"annotations\": {\n           \"list\": [\n              {\n                 \"builtIn\": 1,\n                 \"datasource\": {\n                    \"type\": \"grafana\",\n                    \"uid\": \"-- Grafana --\"\n                 },\n                 \"enable\": true,\n                 \"hide\": true,\n                 \"iconColor\": \"rgba(0, 211, 255, 1)\",\n                 \"name\": \"Annotations \u0026 Alerts\",\n                 \"type\": \"dashboard\"\n              }\n           ]\n        },\n        \"editable\": true,\n        \"fiscalYearStartMonth\": 0,\n        \"graphTooltip\": 0,\n        \"links\": [],\n        \"panels\": [],\n        \"preload\": false,\n        \"refresh\": \"\",\n        \"schemaVersion\": 40,\n        \"tags\": [],\n        \"templating\": {\n           \"list\": []\n        },\n        \"time\": {\n           \"from\": \"now-6h\",\n           \"to\": \"now\"\n        },\n        \"timepicker\": {},\n        \"timezone\": \"browser\",\n        \"title\": \"Example\",\n        \"version\": 0,\n        \"weekStart\": \"\"\n     }\n```\n\n### Dev release installation\n\n1. To download plugin build and move contents into Grafana plugins directory:\n\n   ``` sh\n   ver=$(curl -s https://api.github.com/repos/VictoriaMetrics/victorialogs-datasource/releases/latest | grep -oE 'v[0-9]+\\.[0-9]+\\.[0-9]+' | head -1)\n   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\n   tar -xf /var/lib/grafana/plugins/vl-plugin.tar.gz -C /var/lib/grafana/plugins/\n   rm /var/lib/grafana/plugins/vl-plugin.tar.gz\n   ```\n\n1. Restart Grafana\n\n## Getting started development\n\n### 1. Install [Grafana](https://grafana.com/docs/grafana/latest/setup-grafana/installation/)\n\u003cdetails\u003e\n\u003csummary\u003eTip for Apple(arm64)\u003c/summary\u003e\n\nTo download the `arm64` build of grafana for macOS from the [grafana download page](https://grafana.com/grafana/download?platform=mac), need to change `amd64` to `arm64` in the `wget` url.\n\nMore details about debugging grafana plugin on **Apple Silicon** can be found in [this article](https://st-g.de/2023/10/grafana-plugin-debugging-on-apple-silicon).\n\n\u003c/details\u003e\n\n### 2. Configure Grafana\n\nInstalling dev version of Grafana plugin requires to change `grafana.ini` config to allow loading unsigned plugins:\n\n``` ini\n# Directory where Grafana will automatically scan and look for plugins\nplugins = {{path to directory with plugin}}\n```\n\n``` ini\n[plugins]\nallow_loading_unsigned_plugins = victoriametrics-logs-datasource\n```\n\n### 3. Run the plugin\n\n#### 1. How to run a frontend plugin in development mode:\nIn the project directory, you can run:\n\n```sh\n# install dependencies\nyarn install\n\n# run the app in the development mode\nyarn dev\n\n# build the plugin for production to the `victoriametrics-logs-datasource` folder and zip build\nyarn build:zip\n```\n#### 2. How to run a debugger for a backend plugin:\n\n\n1. install [delve](https://github.com/go-delve/delve)\n```sh\n  go install github.com/go-delve/delve/cmd/dlv@latest\n```\n2. install [mage](https://magefile.org/)\n```sh\n  go install github.com/magefile/mage@latest\n```\n2. install dependencies\n```sh\n  go mod download\n```\n3. build backend plugin\n```sh\n  mage build\n```\n4. build frontend plugin:\n```sh\n  make vl-frontend-plugin-build\n```\n5. run grafana\n5. run debugger for backend plugin\n```sh\n  mage debugger\n```\n6. run debugger in IDE with the following configuration - port:`3222`.\n\n### 4. How to build backend plugin\n\nFrom the root folder of the project run the following command:\n\n```\nmake vl-backend-plugin-build\n```\n\nThis command will build executable multi-platform files to the `victoriametrics-logs-datasource` folder for the following platforms:\n\n* linux/amd64\n* linux/arm64\n* linux/arm\n* linux/386\n* amd64\n* arm64\n* windows\n\n### 5.How to build frontend plugin\n\nFrom the root folder of the project run the following command:\n\n```\nmake vl-frontend-plugin-build\n```\n\nThis command will build all frontend app into `victoriametrics-logs-datasource` folder.\n\n### 6. How to build frontend and backend parts of the plugin:\n\nWhen frontend and backend parts of the plugin is required, run the following command from the root folder of the project:\n\n```\nmake vl-plugin-build\n```\n\nThis command will build frontend part and backend part or the plugin and locate both parts into `victoriametrics-logs-datasource` folder.\n\n## How to make new release\n\n1. Make sure there are no open security issues.\n1. Change version in package.json in a `main` branch\n1. Trigger [release pipeline](https://github.com/VictoriaMetrics/victorialogs-datasource/actions/workflows/release.yaml).\n1. 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.\n\n## Notes\n\nIn 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.\n\nFor more information on the fields in `plugin.json`, please refer to the [Grafana documentation](https://grafana.com/developers/plugin-tools/reference-plugin-json#properties).\n\n## License\n\nThis project is licensed under\nthe [Apache 2.0 license](https://github.com/VictoriaMetrics/victorialogs-datasource/blob/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVictoriaMetrics%2Fvictorialogs-datasource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FVictoriaMetrics%2Fvictorialogs-datasource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVictoriaMetrics%2Fvictorialogs-datasource/lists"}