I have a few points that I am trying to remove that came from bad data and keep reading that you can't really do it but find it hard to believe you really can't.
They have no tags so I tried to give them tags by overwriting them with a tag, then deleting the tag, but it didn't overwrite and i just deleted the new tagged values.
I have the time so tried to delete with where time = 'x' but get a 400 from Chronograf, tried again in Influx CLI with DELETE FROM "apps" where time = '2019-05-01T17:45:00Z' and it runs with no errors, but doesn't actually delete the point.
I understand that because of the way Influx indexes things you can't delete based on fields, but there has to be a way?
Thanks.
I haven't seen explicit examples on deleting series with no tags in official Influxdata docs. But approach like in example below worked for me in test - it drops all series in measurement demo with empty tags. Be careful to include all possible measurement tag names in where clause or you risk to drop good data too.
> drop measurement demo
> select * from demo
> insert demo,tagA=A,tagB=B value=5 123455
> insert demo,tagA=A value=6 123456
> insert demo value=1 123451
> insert demo value=2 123452
> insert demo value=3 123453
> select * from demo
name: demo
time tagA tagB value
---- ---- ---- -----
123451 1
123452 2
123453 3
123455 A B 5
123456 A 6
> drop series from demo where tagA='' and tagB=''
> select * from demo
name: demo
time tagA tagB value
---- ---- ---- -----
123455 A B 5
123456 A 6
Related
this looks like something really straightforward that I am messing up, but can't find what is wrong. I have a simple query where I am trying to retrieve measurements with a specific tag value. I am following the syntax of double quoting the tag_key and single quoting the tag value. E.g., select "score","i_unique"::tag from "events.flow" where "i_unique" = 'my-value'
If you see below:
> select "score","i_unique"::tag from "events.flow" limit 4
name: events.flow
time score i_unique
---- ----- --------
1563464912039000000 462 "42422440-41124048-155896-42266768-229624-233640"
1563464912042000000 462 "42422440-41124048-155896-42266768-42352808-42270864"
......
> select "score","i_unique"::tag from "events.flow" where "i_unique" = '42422440-41124048-155896-42266768-229624-233640'
>
The tag value I want to query for, is in the time series as can be seen by the first select query. But, when I want to pick up just that value by adding a where clause, I am not getting any results.
Any help would be wonderful, Thank You.
Turns out there was an error on my insert. I was inserting an additional double quote for my tag. It is obvious now, when I look at the result of the search query, but missed it completely. So this was a problem with my insert and not select. Once I removed the additional "s, everything is making sense again.
I've been setting up Grafana to pull some annotations from an InfluxDB database.
It seems that when multiple annotations exist within the same millisecond, Grafana will only display the last one.
Is there a way to display multiple annotations that occurred within the same millisecond ? This is for a high-time precison project so I prefer to avoid hacking it by modifying event timestamps.
Here's an example InfluxDB database:
> select * from events;
name: events
time key name title
---- --- ---- -----
1515664469946000001 as_start event1 test
1515664469946999999 as_start event4 test
1515664469947000000 as_start event3 test
1515664469956000000 as_start event2 test
I use the following query in Grafana:
select "name","title","key" from events WHERE $timeFilter
Which yields this:
graph screenshot
"event1" is not visible and was instead "overwritten" by "event4". "event3" and "event2" are visible however.
Thanks!
I'm trying to leverage my moderate SQL-knowledge for InfluxQL, but I'm missing something(s) about the nature of timeseries db.
Use case
I write a measurements from our issue tracker, when an issue is updated:
issue_updated,project=facebook,ticket=fb1,assignee=coolman status="todo"
Problem
Given this returns rows of issues statuses:
SELECT status
FROM "issue_updated"
If this was SQL (fiddle) I would use COUNT(and then add the WHERE time > NOW() - 1Y GROUP BY time(5m)). However the following gives me Mixing aggregate and non-aggregate queries is not supported
SELECT status, count(status) as 'Count'
FROM "issue_updated"
Can someone give some guidance here? ta
Sounds like what you're looking for is the ability to group by a field value which isn't currently supported.
From what I can tell, if you modify your schema a bit, it should be possible to do what you're looking. Instead of
issue_updated,project=facebook,ticket=fb1,assignee=coolman status="todo"
Do
issue_updated,project=facebook,ticket=fb1,assignee=coolman,status=todo value=1
then
SELECT count(value) FROM "issue_updated" WHERE time > now() - 52w GROUP BY status
name: issue_updated
tags: status=other
time count
---- -----
1449523659065350722 1
name: issue_updated
tags: status=todo
time count
---- -----
1449523659065350722 2
should work.
I have started playing around with Influxdb v0.13 and I have some dummy values in my test db where id is a tag and value is a field:
> SELECT * FROM dummy
name: dummy
--------------
time id value
1468276508161069051 1234 12345
1468276539152853428 613 352
1468276543470535110 613 4899
1468276553853436191 1234 12
I get no results returned when I run this query:
> SELECT * FROM dummy WHERE id=1234
but I do get the following when querying with the field instead:
> SELECT * FROM dummy WHERE value=12
name: dummy
--------------
time id value
1468276553853436191 1234 12
Am I doing something wrong here? I thought the point of tags were to be queried (since they are indexed and fields are not), but they seem to break my queries.
It appears that Influx will treat every tag key and value we insert as string and this is evidently shown in their official documentation.
See: https://docs.influxdata.com/influxdb/v0.13/guides/writing_data/
When writing points, you must specify an existing database in the db
query parameter. See the HTTP section on the Write Syntax page for a
complete list of the available query parameters. The body of the POST
- we call this the Line Protocol - contains the time-series data that you wish to store. They consist of a measurement, tags, fields, and a
timestamp. InfluxDB requires a measurement name. Strictly speaking,
tags are optional but most series include tags to differentiate data
sources and to make querying both easy and efficient. Both tag keys
and tag values are strings.
Note: the text in bold.
Hence to filter by tag key value - the query must be enquoted.
Example:
SELECT * FROM dummy WHERE id='1234'
I have the following monitoring stack:
collecting data with telegraf-0.12
storing in influxdb-0.12
visualisation in grafana (3beta)
I am collecting "system" data from several hosts and I want to create a graph showing the "system.load1" of several host NOT merged. I though I could simply add multiple queries to the graph panel.
When creating my graph panel, I create the first serie and see the result but when I add the second query, I got an error.
Here is the panel creation with 2 queries
Here is the query generated by the panel:
SELECT mean("load1") FROM "system" WHERE "host" = 'xxx' AND time > now() - 24h GROUP BY time(1m) fill(null) SELECT mean("load1") FROM "system" WHERE "host" = 'yyy' AND time > now() - 24h GROUP BY time(1m) fill(null)
And the error:
{
"error": "error parsing query: found SELECT, expected ; at line 2, char 1",
"message": "error parsing query: found SELECT, expected ; at line 2, char 1"
}
So I can see that the generated query is malformed (2 select in one line without even a ';') but I don't know how to use Grafana to achieve what I want.
When I show or hide each query individually I see the corresponding graph.
I have created a similar graph (with multiple series) with chronograf but I would rather use grafana as I have many more control and plugins...
Is there something I am doing wrong here ?
After reading couple of thread in github issues, here is a quick fix.
As mentionned by #schup, the problem and its solution are described here:
https://github.com/grafana/grafana/issues/4533
The binaries are currently not fixed in grafana-3beta (if might in the next weeks). So there are 2 options: fixing the source and compile or patched an existing install.
I actually had to patch my current install:
/usr/share/grafana/public/app/app.<number_might_differ_here>.js
sed --in-place=backup 's/join("\\n");return k=k.replace/join(";\\n");return k=k.replace/;s/.replace(\/%3B\/gi,";").replace/.replace/' app.<number_might_differ_here>.js
Hope this might help (and that it will soon be fixed)
Seems to be an API change in influxdb 0.11
https://github.com/grafana/grafana/issues/4533