InfluxDB to Table Panel not matching shell query

  • What Grafana version and what operating system are you using?
    Grafana 9.4.3 - Debian 11
  • What are you trying to achieve?
    Table showing count of top 10 ip addresses
  • How are you trying to achieve it?
    influx query to table panel
  • What happened?
    It only shows the time and count and not the ip address
  • What did you expect to happen?
    I don’t need the time (can filter that out using transform) but do need the ip address which does show up correctly when I run the query from a shell influx session.
  • Can you copy/paste the configuration(s) that you are having problems with?

Influx shell session below

SELECT TOP("count","src_ip",10) FROM (SELECT count("action") FROM "autogen"."tail_ip_block_log" WHERE ("action" = 'block' AND "direction" = 'in') GROUP BY "src_ip")

name: tail_ip_block_log
time top  src_ip
---- ---  ------
0    1460 91.210.107.28
0    867  79.124.58.22
0    843  209.141.43.233
0    711  79.124.62.78
0    702  79.124.62.82
0    667  79.124.62.86
0    657  79.124.62.130
0    392  78.128.114.78
0    389  194.110.203.18
0    370  35.177.70.193

Grafana dashboard

{
  "datasource": {
    "uid": "$dataSource",
    "type": "influxdb"
  },
  "fieldConfig": {
    "defaults": {
      "custom": {
        "align": "left",
        "cellOptions": {
          "type": "auto"
        },
        "inspect": false,
        "filterable": false
      },
      "mappings": [],
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "color": "green",
            "value": null
          },
          {
            "color": "red",
            "value": 80
          }
        ]
      },
      "color": {
        "mode": "thresholds"
      }
    },
    "overrides": []
  },
  "gridPos": {
    "h": 9,
    "w": 3,
    "x": 0,
    "y": 14
  },
  "id": 160,
  "links": [],
  "options": {
    "showHeader": true,
    "footer": {
      "show": false,
      "reducer": [
        "sum"
      ],
      "countRows": false,
      "fields": ""
    },
    "sortBy": [
      {
        "desc": true,
        "displayName": "Blocked"
      }
    ]
  },
  "pluginVersion": "9.4.3",
  "targets": [
    {
      "datasource": {
        "uid": "$dataSource"
      },
      "alias": "",
      "groupBy": [
        {
          "params": [
            "src_ip"
          ],
          "type": "tag"
        }
      ],
      "hide": false,
      "measurement": "tail_ip_block_log",
      "orderByTime": "ASC",
      "policy": "autogen",
      "query": "SELECT TOP(\"count\",\"src_ip\",10) FROM (SELECT count(\"action\") FROM \"autogen\".\"tail_ip_block_log\" WHERE (\"action\" = 'block' AND \"direction\" = 'in') GROUP BY \"src_ip\")",
      "rawQuery": true,
      "refId": "A",
      "resultFormat": "table",
      "select": [
        [
          {
            "params": [
              "action"
            ],
            "type": "field"
          },
          {
            "params": [],
            "type": "count"
          }
        ]
      ],
      "slimit": "10",
      "tags": [
        {
          "key": "host",
          "operator": "=~",
          "value": "/^$Host$/"
        },
        {
          "condition": "AND",
          "key": "action",
          "operator": "=",
          "value": "block"
        },
        {
          "condition": "AND",
          "key": "direction",
          "operator": "=",
          "value": "in"
        }
      ]
    }
  ],
  "title": "IP - Top 10 Blocked - IN",
  "transformations": [],
  "type": "table"
}

Noticed this was working again this morning, checked the version and it is 9.4.7 so I am guessing this was a bug. Closing thread.

1 Like