Query per minute url request success rate

How to use Elastic search query per minute, nginx proxy URL request success rate, the time required to return is continuous, no data is added 0, just like Prometheus rate function?

  • test data:
{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 6,
    "successful" : 6,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 73,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "filebeat-6.4.0-2018.08.30",
        "_type" : "doc",
        "_id" : "_hNkiWUBeM8H3-brbH6H",
        "_score" : 1.0,
        "_source" : {
          "offset" : 1300,
          "nginx" : {
            "access" : {
              "response_code" : "200",
              "method" : "GET",
              "user_name" : "-",
              "http_version" : "1.1",
              "remote_ip_list" : [
                "172.16.4.13"
              ],
              "url" : "/app/api/classes/",
              "referrer" : "-",
              "request_time" : 0.306,
              "remote_ip" : "172.16.4.13",
              "upstream_response_time" : 0.306,
              "body_sent" : {
                "bytes" : "142"
              },
              "user_agent" : {
                "patch" : "3112",
                "major" : "60",
                "minor" : "0",
                "os" : "Ubuntu",
                "name" : "Chromium",
                "os_name" : "Ubuntu",
                "device" : "Other"
              }
            }
          },
          "prospector" : {
            "type" : "log"
          },
          "read_timestamp" : "2018-08-30T05:53:03.653Z",
          "source" : "/var/log/nginx/access.log",
          "message" : "172.16.4.13 - - [30/Aug/2018:05:53:02 +0000] \"GET /app/api/classes/ HTTP/1.1\" 200 142 \"-\" \"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/60.0.3112.78 Chrome/60.0.3112.78 Safari/537.36\" 0.306 0.306 .",
          "fileset" : {
            "module" : "nginx",
            "name" : "access"
          },
          "input" : {
            "type" : "log"
          },
          "@timestamp" : "2018-08-30T05:53:02.000Z",
          "beat" : {
            "hostname" : "liyuanjun-nginx-filebeat.novalocal",
            "name" : "liyuanjun-nginx-filebeat.novalocal",
            "version" : "6.4.0"
          },
          "host" : {
            "name" : "liyuanjun-nginx-filebeat.novalocal"
          }
        }
      },
      {
        "_index" : "filebeat-6.4.0-2018.08.30",
        "_type" : "doc",
        "_id" : "3hNwiWUBeM8H3-brGIHo",
        "_score" : 1.0,
        "_source" : {
          "offset" : 1778,
          "nginx" : {
            "access" : {
              "response_code" : "200",
              "method" : "GET",
              "user_name" : "-",
              "http_version" : "1.1",
              "remote_ip_list" : [
                "172.16.4.13"
              ],
              "url" : "/app/paths",
              "referrer" : "-",
              "request_time" : 0.357,
              "remote_ip" : "172.16.4.13",
              "upstream_response_time" : 0.357,
              "body_sent" : {
                "bytes" : "1208"
              },
              "user_agent" : {
                "patch" : "3112",
                "major" : "60",
                "minor" : "0",
                "os" : "Ubuntu",
                "name" : "Chromium",
                "os_name" : "Ubuntu",
                "device" : "Other"
              }
            }
          },
          "prospector" : {
            "type" : "log"
          },
          "read_timestamp" : "2018-08-30T06:05:48.679Z",
          "source" : "/var/log/nginx/access.log",
          "message" : "172.16.4.13 - - [30/Aug/2018:06:05:45 +0000] \"GET /app/paths HTTP/1.1\" 200 1208 \"-\" \"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/60.0.3112.78 Chrome/60.0.3112.78 Safari/537.36\" 0.357 0.357 .",
          "fileset" : {
            "module" : "nginx",
            "name" : "access"
          },
          "input" : {
            "type" : "log"
          },
          "@timestamp" : "2018-08-30T06:05:45.000Z",
          "host" : {
            "name" : "liyuanjun-nginx-filebeat.novalocal"
          },
          "beat" : {
            "hostname" : "liyuanjun-nginx-filebeat.novalocal",
            "name" : "liyuanjun-nginx-filebeat.novalocal",
            "version" : "6.4.0"
          }
        }
      },
      {
        "_index" : "filebeat-6.4.0-2018.08.30",
        "_type" : "doc",
        "_id" : "8hNwiWUBeM8H3-brU4GB",
        "_score" : 1.0,
        "_source" : {
          "offset" : 2249,
          "nginx" : {
            "access" : {
              "response_code" : "200",
              "method" : "GET",
              "user_name" : "-",
              "http_version" : "1.1",
              "remote_ip_list" : [
                "172.16.4.13"
              ],
              "url" : "/app/api/users/",
              "referrer" : "-",
              "request_time" : 0.345,
              "remote_ip" : "172.16.4.13",
              "upstream_response_time" : 0.345,
              "body_sent" : {
                "bytes" : "140"
              },
              "user_agent" : {
                "patch" : "3112",
                "major" : "60",
                "minor" : "0",
                "os" : "Ubuntu",
                "name" : "Chromium",
                "os_name" : "Ubuntu",
                "device" : "Other"
              }
            }
          },
          "prospector" : {
            "type" : "log"
          },
          "read_timestamp" : "2018-08-30T06:06:03.680Z",
          "source" : "/var/log/nginx/access.log",
          "fileset" : {
            "module" : "nginx",
            "name" : "access"
          },
          "message" : "172.16.4.13 - - [30/Aug/2018:06:05:59 +0000] \"GET /app/api/users/ HTTP/1.1\" 200 140 \"-\" \"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/60.0.3112.78 Chrome/60.0.3112.78 Safari/537.36\" 0.345 0.345 .",
          "input" : {
            "type" : "log"
          },
          "@timestamp" : "2018-08-30T06:05:59.000Z",
          "beat" : {
            "hostname" : "liyuanjun-nginx-filebeat.novalocal",
            "name" : "liyuanjun-nginx-filebeat.novalocal",
            "version" : "6.4.0"
          },
          "host" : {
            "name" : "liyuanjun-nginx-filebeat.novalocal"
          }
        }
      }
    ]
  }
}

I looked at the documentation, but I couldn't find a function like this. Do you have a good example? Thank you very much.

It's not really clear what you are after sorry. Can you rephrase your question?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.