Influx v1 shell not seeing the database

I am having set up influxdb:alpine and telegraf:alpine dockers on my system and have created a telegraf feed to pass docker logs to influx.

Therefore, the database being stored is in json_file format.

Viewing it in influxdb I see the information correctly but not as a json. I understand I need to use v1 CLI. However, I am having issues querying the data in influx CLI.

This is the problem I see:

As we can see, there is a database called logs.

However, when I query it, this is what I get:

C:>influx v1 shell
InfluxQL Shell dev
Connected to InfluxDB OSS v2.7.1

select * from logs
Error: database name required
No results
quit
Goodbye!

Why is it saying database name required, if the database is listed in the previous screen?

@kpankhurst With the InfluxQL shell, you have to tell it which database to use:

> USE databaseName

Also, in your InfluxQL query, your FROM statement should actually specify the measurement to query, not necessarily the database. If the database name is in your FROM clause, it’s only part of a “fully-qualified” measurement name. For example:

Query with just measurement
SELECT * FROM home
Query with a fully qualified measurement
SELECT * FROM "database-name"."retention-policy-name".home

So in your case, assuming your database name is logs and you want to query everything from the home measurement:

C:>influx v1 shell
InfluxQL Shell dev
Connected to InfluxDB OSS v2.7.1
> USE logs
> SELECT * FROM home
1 Like

Thanks, you helped a total novice :slight_smile: :smiley: