Discussion:
[influxdb] How to do continuous updates (calculated fields) in InfluxDB?
Niels van Klaveren
2017-04-18 12:24:46 UTC
Permalink
I'm getting Nginx reverse proxy data into Influx through the Telegraf
logparser.

Nginx outputs some fields that measure duration as part of another duration
(i.e. upstream_response_time is part of the total response_time). For
analysis, it would be best to have a separate field that's response_time -
upstream_response_time.

Since Telegraf's logparser plugin is incapable of transformation steps like
that, I tried to implement it as a continuous query in Influx, SELECT INTOing
each record with extra calculated fields into another retention policy.

CREATE DATABASE nginx_logs;

CREATE RETENTION POLICY "one_hour" ON "nginx_logs" DURATION 1h REPLICATION
1 DEFAULT;

CREATE RETENTION POLICY "one_day" ON "nginx_logs" DURATION 1d REPLICATION 1;

CREATE CONTINUOUS QUERY "separate_timings" ON "nginx_logs" BEGIN
SELECT
*,
"response_time" - "upstream_connection_time" -
"upstream_response_time" as downstream_time,
"upstream_response_time" - "upstream_header_time" as
upstream_body_time
INTO "one_day"."saas_requests_enhanced"
FROM "saas_requests"
END;

However, that doesn't work since a continuous query needs a GROUP BY
time(unit) clause.

What would be the way to go about this in Influx or the TICK stack ?
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups "InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to influxdb+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/337da1b6-2d27-42bd-aba6-09ddaed6958a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...