Inner Join in Grafana
10:24 29 Jul 2026

I have the following

  • Table panel

  • Two Loki queries

  • Query A returns no rows

  • Query B returns rows

  • joinByField(mode="inner")

  • Expected: empty table

  • Actual: Query B is displayed

The query both are setup to return the join field through a line transformation, this works fine for the results of query B, but query A does not return data (situation being querried has not occurred)

This is the setup for the panel:

{
  "id": 1,
  "type": "table",
  "title": "Title for Panel",
  "gridPos": {
    "x": 0,
    "y": 0,
    "h": 8,
    "w": 12
  },
  "fieldConfig": {
    "defaults": {
      "custom": {
        "align": "auto",
        "footer": {
          "reducers": []
        },
        "cellOptions": {
          "type": "auto"
        },
        "inspect": false,
        "filterable": true,
        "hideFrom": {
          "viz": false
        }
      },
      "mappings": [],
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "color": "green",
            "value": null
          },
          {
            "color": "red",
            "value": 80
          }
        ]
      },
      "color": {
        "mode": "thresholds"
      }
    },
    "overrides": []
  },
  "transformations": [
    {
      "filter": {
        "id": "byRefId",
        "options": "/^(?:A)$/"
      },
      "id": "extractFields",
      "options": {
        "delimiter": ",",
        "format": "json",
        "keepTime": false,
        "replace": false,
        "source": "Line",
        "jsonPaths": []
      }
    },
    {
      "filter": {
        "id": "byRefId",
        "options": "/^(?:B)$/"
      },
      "id": "extractFields",
      "options": {
        "delimiter": ",",
        "format": "json",
        "source": "Line"
      }
    },
    {
      "id": "joinByField",
      "options": {
        "byField": "event_id",
        "mode": "inner"
      }
    },
    {
      "id": "filterFieldsByName",
      "options": {
        "include": {
          "names": [
            "event_id",
            "debtor",
            "source"
          ]
        }
      }
    }
  ],
  "pluginVersion": "12.3.1",
  "targets": [
    {
      "datasource": {
        "type": "loki",
        "uid": "<>"
      },
      "direction": "backward",
      "editorMode": "code",
      "expr": "{job=\"<>\"}\n| regexp `event: (?P[a-f0-9-]+)`\n| line_format `{\"source\":\"A\",\"event_id\":\"{{.event_id}}\"}`",
      "queryType": "range",
      "refId": "A"
    },
    {
      "datasource": {
        "type": "loki",
        "uid": "<>"
      },
      "direction": "backward",
      "editorMode": "code",
      "expr": "{job=\"<>\"}\n| regexp `event: (?P[a-f0-9-]+)`\n| regexp `Debtor (?P\\d+)`\n| line_format `{\"source\":\"B\",\"event_id\":\"{{.event_id}}\",\"debtor\":\"{{.debtor}}\"}`",
      "hide": false,
      "queryType": "range",
      "refId": "B"
    }
  ],
  "datasource": {
    "type": "loki",
    "uid": "<>"
  },
  "options": {
    "showHeader": true,
    "cellHeight": "sm",
    "enablePagination": true
  }
}
grafana-loki