suzuki-shunsuke/go-graylog

Unsupported dashboard widgets

Closed this issue · 10 comments

Hi!

Is it possible to implement unsupported dashboard widgets? In my case the STACKED_CHART is very useful but it's not supported now.
According to the documentation stacked charts are basically field value charts represented in the same axes but I have no idea hot complicates is to implement it..

Thank you!

Thank you for your feedback.
I'll check later.

Could you give me some information about the data structure of STACKED_CHART?
I don't know this type of widget.
How do we create this type of widget?
Could you give me the response of the API GET /dashboards/{dashboardId}/widgets/{widgetId}? http://127.0.0.1:9000/api/api-browser/#!/Dashboards/Widgets/getWidget_get_3

I have created the pull request. #228

I appreciate if you give me appropriate example of the dashboard widget STACKED_CHART.

I don't know STACKED CHART so currently the example is probably inappropriate.

#228 (comment)

resource "graylog_dashboard_widget" "stacked_chart" {
  description = "stacked chart"
  dashboard_id = graylog_dashboard.test.id
  type         = "STACKED_CHART"
  cache_time = 10
  json_configuration = <<EOF
{
  "interval": "hour",
  "timerange": {
    "type": "relative",
    "range": 86400
  },
  "renderer": "bar",
  "interpolation": "linear",
  "series": [
    {
      "query": "",
      "field": "AccessMask",
      "statistical_function": "count"
    }
  ]
}
EOF
}

I have released v10.0.0-0.
Please check.
If there is no problem, I will release v10.0.0.

I'm sorry I was not able to provide a working example earlier.
This is the example which displays nginx status codes on one chart:

{
   "creator_user_id":"admin",
   "cache_time":10,
   "description":"HTTP response codes",
   "id":"971374a4-75a4-4da9-ae5a-956b105382bb",
   "type":"STACKED_CHART",
   "config":{
      "interval":"minute",
      "timerange":{
         "type":"relative",
         "range":86400
      },
      "renderer":"area",
      "interpolation":"linear",
      "series":[
         {
            "query":"labels_app: nginx-ingress AND response:[200 TO 299]",
            "field":"response",
            "statistical_function":"count"
         },
         {
            "query":"labels_app: nginx-ingress AND response:[500 TO 599]",
            "field":"response",
            "statistical_function":"count"
         },
         {
            "query":"labels_app: nginx-ingress AND response:[400 TO 499]",
            "field":"response",
            "statistical_function":"count"
         },
         {
            "query":"labels_app: nginx-ingress AND response:[300 TO 399]",
            "field":"response",
            "statistical_function":"count"
         }
      ]
   }
}

Going to test v10

Seems to work great, thank you!
Here is the complete working example:

resource "graylog_dashboard_widget" "http_response_codes" {
  dashboard_id = graylog_dashboard.ingress_respose_codes.id
  description = "${var.env_name} ingress response codes"
  type = "STACKED_CHART"
  json_configuration = <<EOF
{
  "interval": "minute",
  "timerange": {
    "type": "relative",
    "range": 86400
  },
  "renderer": "area",
  "interpolation": "linear",
  "stream_id": "${graylog_stream.environment-all-messages.id}",
  "series": [
    {
      "query": "labels_app: nginx-ingress AND response:[200 TO 299]",
      "field": "response",
      "statistical_function": "count"
    },
    {
      "query": "labels_app: nginx-ingress AND response:[500 TO 599]",
      "field": "response",
      "statistical_function": "count"
    },
    {
      "query": "labels_app: nginx-ingress AND response:[400 TO 499]",
      "field": "response",
      "statistical_function": "count"
    },
    {
      "query": "labels_app: nginx-ingress AND response:[300 TO 399]",
      "field": "response",
      "statistical_function": "count"
    }
  ]
}
EOF
}

Thank you for your testing and example!
I found a bug and fix it by #229

I have released v10.0.0

Thank you again, closing.