TL;DR InfluxDB Tech Tips: Identical Field Keys & Tag Keys, Existing Kapacitor TICKscripts in Chronograf & More

4 minutes

In this post, we recap some new material that you might have missed in the past week or so. Check in next week for the most interesting TICK-stack related issues, workarounds, how-tos, and Q&A from GitHub, IRC, and the InfluxData Community.

Identical field keys and tag keys

Q: My InfluxDB schema consists of the feet-attire measurement, the shoes tag which tracks shoe color, and the shoes field which tracks shoe quantity. When I attempt to query both the shoes tag and the shoe field, I see duplicate rows of the shoe field but nothing for the shoe tag. Is there a way to see both the field and tag?

> SELECT "shoes","shoes" FROM "feet-attire"

name: feet-attire
time                            shoes shoes_1
----                            ----- -------
2017-05-17T20:34:32.143717027Z  12    12
2017-05-17T20:34:39.949844001Z  15    15
2017-05-17T20:34:47.325195089Z  16    16

A: There is! Use the :: syntax to specify if the identifier is a field or tag:

> SELECT "shoes"::field,"shoes"::tag FROM "feet-attire"

name: feet-attire
time                            shoes shoes_1
----                            ----- -------
2017-05-17T20:34:32.143717027Z  12    yellow
2017-05-17T20:34:39.949844001Z  15    blue
2017-05-17T20:34:47.325195089Z  16    pink

Field keys or tag keys called time

Q: I’m using InfluxDB version 1.2.2 and I can’t seem to query my data. It looks like the write succeeds but my queries don’t return any results. Can you help me out? What am I doing wrong?

~# curl -i -XPOST "http://localhost:8086/write?db=tldr&u=<username>&p=<password>" --data-binary 'creatures time="1h"'
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: b76456c6-3b47-11e7-8f86-000000000000
X-Influxdb-Version: 1.2.1-c1.2.2
Date: Wed, 17 May 2017 21:28:06 GMT

~# curl -G "http://localhost:8086/query?db=tldr&u=<username>&p=<password>" --data-urlencode 'q=SHOW MEASUREMENTS'
{"results":[{"statement_id":0}]}


~# curl -G "http://localhost:8086/query?db=tldr&u=<username>&p=<password>" --data-urlencode 'q=SELECT * FROM creatures'
{"results":[{"statement_id":0}]}

A: Your syntax looks good! It’s time that’s causing the issue. time is a special keyword in InfluxDB. time can be a continuous query name, database name, measurement name, retention policy name, subscription name, and username. It can’t be a field key or tag key in InfluxDB.

In version 1.2.2 (more specifically, versions 1.2.0-1.2.3), InfluxDB accepts writes with time as a field or tag key but it silently drops the field key or tag key and its associated value. In version 1.2.4, we’ve changed that behavior; InfluxDB rejects writes with time as a field key or tag key and returns an error. Check out our FAQ page for more information!

Existing Kapacitor TICKscripts in Chronograf

Q: I just started using Chronograf and I have some Kapacitor tasks that I created prior to using Chronograf. Will those tasks show up on Chronograf’s Alert Rules page?

A: Currently, Kapacitor tasks that you created outside of Chronograf have limited functionality in the user interface.

In Chronograf, you can:

  • View pre-existing tasks the Alert Rules page
  • View pre-existing tasks’ activity on the Alert History page
  • Enable and disable pre-existing tasks on the Alert Rules page (this is equivalent to the kapacitor enable and kapacitor disable commands)
  • Delete pre-existing tasks the Alert Rules page (this is equivalent to the kapacitor delete tasks command)

You cannot edit pre-existing tasks on Chronograf’s Alert Rules page. The mytick task in the image below is a pre-existing task; its name appears on the Alert Rules page but you cannot click on it or edit its TICKscript in the interface. Currently, you must manually edit your existing tasks and TICKscripts on your machine.

What’s next:

  • Downloads for the TICK-stack are live on our “downloads” page.
  • Deploy on the Cloud: Get started with a FREE trial of InfluxDB Cloud featuring fully-managed clusters, Kapacitor and Grafana.
  • Deploy on Your Servers: Want to run InfluxDB clusters on your servers? Try a FREE 14-day trial of InfluxDB Enterprise featuring an intuitive UI for deploying, monitoring, and rebalancing clusters, plus managing backups and restores. 
  • Tell Your Story: Over 300 companies have shared their story on how InfluxDB is helping them succeed. Submit your testimonial and get a limited edition hoodie as a thank you.

Related Blog Posts

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top