nginx PVs of today and day-to-day comparison with yesterday from NGINX logs
Use the count function to calculate the total page views (PVs) and then use the compare function to obtain the day-to-day comparison for PVs of today and yesterday.
The results are displayed in a single value chart. In this example, the number of PVs of today is 20.381Mil, with a change of –2% compared with that of yesterday.
SQL
* |
select
diff [1] as today,
round((diff [3] -1.0) * 100, 2) as growth
FROM
(
SELECT
compare(pv, 86400) as diff
FROM
(
SELECT
COUNT(1) as pv
FROM
log
)
)