We have our logs in Elasticsearch which are normalized. Here is what we store in nginx logs.
“_source”: {
“remote”: “influx-dev-cluster01”,
“host”: “10.88.14.126”,
“ident”: “-”,
“user”: “user”,
“method”: “POST”,
“path”: “/query?db=&q”,
“code”: “200”,
“size”: “236”,
“referer”: “-”,
“agent”: “DBClient”,
“upstream_latency”: “0.002”,
“latency”: “0.000”,
“hostname”: “ssd02”,
“component”: ““influxdb””,
“@timestamp”: “2019 Jan 11 12:40:59”,
“tag”: “nginx”
}
I want to visualize availability. Definition of availability is
Availability % = ( Successful Requests * 100 ) / ( Success Requests + Failed Requests )
Where Successful requests.= requests with response code < 500 and
Failed Requests = requests with response code >= 500
Can some one help me or guide with writing query to calculate the approach. We want to visualize this with grafana