I have created a new visualization with the number of requests for an Apache log.
Y-Axis: Count
X-Axis: Date Histogram using timestamp field and interval set to Hourly.
This shows the total number of events of every hour, but we want to obtain the number of requests per second, so I need to divide the "count" by 3600.
I have tried using the "JSON Input", but it only applies to the "key" field.
Eg. without "JSON Input":
{
"key_as_string": "2015-06-10T08:00:00.000Z",
"key": 1433923200000,
"doc_count": 2198
},
{
"key_as_string": "2015-06-10T09:00:00.000Z",
"key": 1433926800000,
"doc_count": 2383
},
If I set something in "JSON Input" for the Y-Axis it is ignored (doesn't appear in the json request).
If I set {"script":"_value/3600"} in the "JSON Input" for the "X-Axis", it is added to the aggregation field of the request:
"aggs": {
"2": {
"date_histogram": {
"field": "@timestamp",
"interval": "1h",
...
"script": "_value/3600"
And the response:
{
"key_as_string": "1970-01-05T14:00:00.000Z",
"key": 396000000,
"doc_count": 48531
}
396000000 is timestamp/3600.
Thanks