Как создать таблицу Grafana с использованием двух разных массивов данных JSON - PullRequest
0 голосов
/ 05 марта 2020

Я новичок вasticsearch (7.6.0) и Grafana (6.6.2). Мне нужно создать следующий тип таблицы в графане.

Пример таблицы Grafana

Я использовал Logsta sh в качестве конвейера данных, и ниже приведены подробные сведения о файлах конфигурации, ввода и вывода

Файл конфигурации Logsta sh

    input {
    file {
        path => "/vegeta/*.json"
        start_position => "beginning"
        codec => "json"
    }
}

filter {
    json {
        source => "message"
    }
    grok {
        match => ["path", "%{GREEDYDATA}/%{GREEDYDATA:ReportTitle}\.json"]
    }
}


output {
    elasticsearch {
        hosts => ["localhost:9200"]
    }
    stdout {
        codec => rubydebug
    }
}

Ниже приводится входной файл JSON,

{"latencies":{"total":3981710268690,"mean":43876078,"50th":916913,"90th":2217744,"95th":5162430,"99th":60233348,"max":60000209373,"min":43652},"bytes_in":{"total":6434375,"mean":70.90298515686123},"bytes_out":{"total":6434375,"mean":70.90298515686123},"earliest":"2020-03-05T16:13:43.069971588Z","latest":"2020-03-05T16:14:44.23387091Z","end":"2020-03-05T16:14:44.234423019Z","duration":61163899322,"wait":552109,"requests":90749,"rate":1483.702004057131,"throughput":2.0436707446156577,"success":0.0013774256465635985,"status_codes":{"0":90624,"200":125},"errors":["Post http://www: dial tcp 0.0.0.0:0-\u003e10.20.20.20:12: socket: too many open files","Post http://www: dial tcp: lookup internal-netty-load-balancer-937469711.us-east-1.elb.amazonaws.com on 10.20.20.20:12: dial udp 10.20.20.20:12: socket: too many open files"]}
{"latencies":{"total":83755527693327,"mean":698183822,"50th":926706,"90th":2405428,"95th":5758148,"99th":15891402130,"max":80009300782,"min":43652},"bytes_in":{"total":8338950,"mean":69.51326253313549},"bytes_out":{"total":8338950,"mean":69.51326253313549},"earliest":"2020-03-05T16:13:43.055326572Z","latest":"2020-03-05T16:15:03.051213863Z","end":"2020-03-05T16:15:44.880149245Z","duration":79995887291,"wait":41828935382,"requests":119962,"rate":1499.6020928377955,"throughput":1.3297782540988177,"success":0.0013504276354178823,"status_codes":{"0":119800,"200":162},"errors":["Post http://www: dial tcp 0.0.0.0:0-\u003e10.20.20.20:12: socket: too many open files","Post http://www: dial tcp: lookup internal-netty-load-balancer-937469711.us-east-1.elb.amazonaws.com on 10.20.20.20:12: dial udp 10.20.20.20:12: socket: too many open files","net/http: request canceled (Client.Timeout exceeded while reading body)","Post http://www: net/http: request canceled (Client.Timeout exceeded while awaiting headers)"]}
{"latencies":{"total":1761306620988103,"mean":9785036783,"50th":1320320,"90th":36045845674,"95th":41953885708,"99th":47089998119,"max":80009300782,"min":43652},"bytes_in":{"total":11427450,"mean":63.48583333333333},"bytes_out":{"total":11427450,"mean":63.48583333333333},"earliest":"2020-03-05T16:13:43.055326572Z","latest":"2020-03-05T16:15:43.054498067Z","end":"2020-03-05T16:16:05.105887003Z","duration":119999171495,"wait":22051388936,"requests":180000,"rate":1500.0103563840025,"throughput":1.5628238236190193,"success":0.0012333333333333332,"status_codes":{"0":179778,"200":222},"errors":["Post http://www: dial tcp 0.0.0.0:0-\u003e10.20.20.20:12: socket: too many open files","Post http://www: dial tcp: lookup internal-netty-load-balancer-937469711.us-east-1.elb.amazonaws.com on 10.20.20.20:12: dial udp 10.20.20.20:12: socket: too many open files","net/http: request canceled (Client.Timeout exceeded while reading body)","Post http://www: net/http: request canceled (Client.Timeout exceeded while awaiting headers)","Post http://www: EOF"]}

Ниже приведен файл вывода Logsta sh для эластичного поиска

{   "latencies":{
      "total":3981710268690,
      "mean":43876078,
      "50th":916913,
      "90th":2217744,
      "95th":5162430,
      "99th":60233348,
      "max":60000209373,
      "min":43652

},
   "@version":"1",
   "latest":"2020-03-05T16:14:44.23387091Z",
   "path":"/test.json",
   "duration":61163899322,
   "wait":552109,
   "status_codes":{
      "0":90624,
      "200":125

},
   "earliest":"2020-03-05T16:13:43.069971588Z",
   "rate":1483.702004057131,
   "throughput":2.0436707446156577,
   "@timestamp":"2020-03-05T16:14:44.453Z",
   "errors":[
      "Post http://www: dial tcp 0.0.0.0:0->10.20.20.10:8688: socket: too many open files",
      "Post http://www: dial tcp: lookup internal-netty-load-balancer-937469711.us-east-1.elb.amazonaws.com on 10.20.20.10: dial udp 10.20.20.10: socket: too many open files"

],
   "bytes_in":{
      "mean":70.90298515686123,
      "total":6434375

},
   "requests":90749,
   "Report_Title":"apigee_test23",
   "host":"ABS",
   "success":0.0013774256465635985,
   "end":"2020-03-05T16:14:44.234423019Z",
   "bytes_out":{
      "mean":70.90298515686123,
      "total":6434375

}
}{   "latencies":{
      "total":83755527693327,
      "mean":698183822,
      "50th":926706,
      "90th":2405428,
      "95th":5758148,
      "99th":15891402130,
      "max":80009300782,
      "min":43652

},
   "@version":"1",
   "latest":"2020-03-05T16:15:03.051213863Z",
   "path":"/test.json",
   "duration":79995887291,
   "wait":41828935382,
   "status_codes":{
      "0":119800,
      "200":162

},
   "earliest":"2020-03-05T16:13:43.055326572Z",
   "rate":1499.6020928377955,
   "throughput":1.3297782540988177,
   "@timestamp":"2020-03-05T16:15:45.513Z",
   "errors":[
      "Post http://www: dial tcp 0.0.0.0:0->10.20.20.10:8688: socket: too many open files",
      "Post http://www: dial tcp: lookup internal-netty-load-balancer-937469711.us-east-1.elb.amazonaws.com on 10.20.20.10: dial udp 10.20.20.10: socket: too many open files",
      "net/http: request canceled (Client.Timeout exceeded while reading body)",
      "Post http://www: net/http: request canceled (Client.Timeout exceeded while awaiting headers)"

],
   "bytes_in":{
      "mean":69.51326253313549,
      "total":8338950

},
   "requests":119962,
   "Report_Title":"apigee_test23",
   "host":"ABS",
   "success":0.0013504276354178823,
   "end":"2020-03-05T16:15:44.880149245Z",
   "bytes_out":{
      "mean":69.51326253313549,
      "total":8338950

}
}{   "latencies":{
      "total":1761306620988103,
      "mean":9785036783,
      "50th":1320320,
      "90th":36045845674,
      "95th":41953885708,
      "99th":47089998119,
      "max":80009300782,
      "min":43652

},
   "@version":"1",
   "latest":"2020-03-05T16:15:43.054498067Z",
   "path":"/test.json",
   "duration":119999171495,
   "wait":22051388936,
   "status_codes":{
      "0":179778,
      "200":222

},
   "earliest":"2020-03-05T16:13:43.055326572Z",
   "rate":1500.0103563840025,
   "throughput":1.5628238236190193,
   "@timestamp":"2020-03-05T16:16:05.530Z",
   "errors":[
      "Post http://wwww: dial tcp 0.0.0.0:0->10.20.20.10:8688: socket: too many open files",
      "Post http://www: dial tcp: lookup internal-netty-load-balancer-937469711.us-east-1.elb.amazonaws.com on 10.20.20.10: dial udp 10.20.20.10: socket: too many open files",
      "net/http: request canceled (Client.Timeout exceeded while reading body)",
      "Post http://www: net/http: request canceled (Client.Timeout exceeded while awaiting headers)",
      "Post http://www: EOF"

],
   "bytes_in":{
      "mean":63.48583333333333,
      "total":11427450

},
   "requests":180000,
   "Report_Title":"apigee_test23",
   "host":"ABS",
   "success":0.0012333333333333332,
   "end":"2020-03-05T16:16:05.105887003Z",
   "bytes_out":{
      "mean":63.48583333333333,
      "total":11427450

}
}

Может ли кто-нибудь помочь мне.

Заранее спасибо.

...