How to enable debug log level using "influxd" command

Hi,

The below is the influxdb.conf file:

[meta]
  dir = "/var/lib/influxdb/meta"
  logging-enabled = true

[data]
  dir = "/var/lib/influxdb/data"
  engine = "tsm1"
  wal-dir = "/var/lib/influxdb/wal"
  query-log-enabled = true

[logging]
  level = "debug"

I used the below the command to start influxdb daemon:

/usr/bin/influxd -config /etc/influxdb/influxdb.conf 

but the logs still shows the “info” level log not a debug level; even i configured it.

influxdb_1    | ts=2020-08-26T04:37:21.526252Z lvl=info msg="Executing query" log_id=0OrGI1Ml000 service=query query="SHOW RETENTION POLICIES ON mydb"

Does this work?
/usr/bin/influxd --log-level debug -config /etc/influxdb/influxdb.conf

I’m getting the below error:


influxdb_1    | flag provided but not defined: -log-level
influxdb_1    | Runs the InfluxDB server.
influxdb_1    |
influxdb_1    | Usage: influxd run [flags]
influxdb_1    |
influxdb_1    |     -config <path>
influxdb_1    |             Set the path to the configuration file.
influxdb_1    |             This defaults to the environment variable INFLUXDB_CONFIG_PATH,
influxdb_1    |             ~/.influxdb/influxdb.conf, or /etc/influxdb/influxdb.conf if a file
influxdb_1    |             is present at any of these locations.
influxdb_1    |             Disable the automatic loading of a configuration file using
influxdb_1    |             the null device (such as /dev/null).
influxdb_1    |     -pidfile <path>
influxdb_1    |             Write process ID to a file.
influxdb_1    |     -cpuprofile <path>
influxdb_1    |             Write CPU profiling information to a file.
influxdb_1    |     -memprofile <path>
influxdb_1    |             Write memory usage information to a file.
influxdb_1    |
influxdb_1    | run: flag provided but not defined: -log-level

It seems no such option --log-level debug was there with influxd command

Can you confirm you’re using influxdb2 per the tag label on this thread?

https://v2.docs.influxdata.com/v2.0/reference/config-options/#log-level

Sorry, It seems I’m not using influxdb2.

I’m using the below version

root@influxdb:/opt/influxdb-backup# influx --version
InfluxDB shell version: 1.7.10

All good. Seems it’s called just level in 1.x

https://docs.influxdata.com/influxdb/v1.7/administration/logs#logging-levels

Maybe try moving the logging block in your config higher up in the file - perhaps it needs to be set before the enabled parameter gets seen by the loader.

As you said, I’ve moved the logging up in the file but no luck ( still info level logs are coming ).

influxdb.conf

[logging]
  level = "debug"

[meta]
  dir = "/var/lib/influxdb/meta"
  logging-enabled = true

[data]
  dir = "/var/lib/influxdb/data"
  engine = "tsm1"
  wal-dir = "/var/lib/influxdb/wal"
  query-log-enabled = true

Running influxdb deamon

/usr/bin/influxd -config /etc/influxdb/influxdb.conf

logs

influxdb_1    | ts=2020-08-27T06:54:51.521890Z lvl=info msg="Executing query" log_id=0OsfxeCG000 service=query query="SHOW SUBSCRIPTIONS"

That’s very strange. Maybe @Anaisdg can spot what’s missing to get debug logging enabled.

Also, if you’re still on 1.7.x you might want to consider upgrading to the latest 1.8 release

1 Like

Influxdb version

cmurugan@testing:/var/lib/influxdb$ influx --version
InfluxDB shell version: 1.8.2

Configuration File:

cmurugan@testing:/var/lib/influxdb$ cat /etc/influxdb/influxdb.conf
[logging]
  level = "debug"

[meta]
  dir = "/var/lib/influxdb/meta"
  logging-enabled = true

[data]
  dir = "/var/lib/influxdb/data"
  engine = "tsm1"
  wal-dir = "/var/lib/influxdb/wal"
  query-log-enabled = true

Status:

cmurugan@testing:/var/lib/influxdb$ sudo systemctl status influxdb.service
● influxdb.service - InfluxDB is an open-source, distributed, time series database
     Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2020-08-28 02:27:52 EDT; 12s ago
       Docs: https://docs.influxdata.com/influxdb/
   Main PID: 59365 (influxd)
      Tasks: 10 (limit: 9488)
     Memory: 8.7M
     CGroup: /system.slice/influxdb.service
             └─59365 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

Aug 28 02:27:52 maas-testing influxd[59365]: ts=2020-08-28T06:27:52.396404Z lvl=info msg="Starting precreation service" log_id=0OtwrcNG000 service=shard-precre>
Aug 28 02:27:52 maas-testing influxd[59365]: ts=2020-08-28T06:27:52.396411Z lvl=info msg="Starting snapshot service" log_id=0OtwrcNG000 service=snapshot
Aug 28 02:27:52 maas-testing influxd[59365]: ts=2020-08-28T06:27:52.396434Z lvl=info msg="Starting continuous query service" log_id=0OtwrcNG000 service=continu>
Aug 28 02:27:52 maas-testing influxd[59365]: ts=2020-08-28T06:27:52.396446Z lvl=info msg="Starting HTTP service" log_id=0OtwrcNG000 service=httpd authenticatio>
Aug 28 02:27:52 maas-testing influxd[59365]: ts=2020-08-28T06:27:52.396452Z lvl=info msg="opened HTTP access log" log_id=0OtwrcNG000 service=httpd path=stderr
Aug 28 02:27:52 maas-testing influxd[59365]: ts=2020-08-28T06:27:52.396538Z lvl=info msg="Listening on HTTP" log_id=0OtwrcNG000 service=httpd addr=[::]:8086 ht>
Aug 28 02:27:52 maas-testing influxd[59365]: ts=2020-08-28T06:27:52.396558Z lvl=info msg="Starting retention policy enforcement service" log_id=0OtwrcNG000 ser>
Aug 28 02:27:52 maas-testing influxd[59365]: ts=2020-08-28T06:27:52.399249Z lvl=info msg="Storing statistics" log_id=0OtwrcNG000 service=monitor db_instance=_i>
Aug 28 02:27:52 maas-testing influxd[59365]: ts=2020-08-28T06:27:52.399426Z lvl=info msg="Sending usage statistics to usage.influxdata.com" log_id=0OtwrcNG000
Aug 28 02:27:52 maas-testing influxd[59365]: ts=2020-08-28T06:27:52.400539Z lvl=info msg="Listening for signals" log_id=0OtwrcNG000

Still I’m getting info level logs.full_config.txt (3.4 KB)

hi, Could you please help me on this issue?

Hi,

Any update on this query?

Are you trying to not show info level logs? Or are you trying to show debug level logs?

debug is more verbose than info, so it will include all info log messages (as well as warn and error messages).

Yes I’m trying to display only debug level logs.

The logging levels aren’t exclusive, so level="debug" means “Show me any messages at level debug or higher”, which is going to include all other level messages.

@mhall119, yes. I’m getting all levels( error, info, warn ). you opened my eyes. Thanks.

1 Like

This is the answer. :grinning:

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.