How to change Prometheus startup logs to debug?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 怎么变更prometheus启动日志为debug?

| username: 逍遥_猫

How can I change the Prometheus log level to debug mode when it starts with the cluster? I want to check the status of it pulling monitoring data.

| username: 逍遥_猫 | Original post link

tiup cluster stop tidb1 -R prometheus
Then manually start prometheus, it keeps reporting connection refused errors

Check the startup process, it is already in debug mode


But there is no change in its log

| username: 逍遥_猫 | Original post link

Test Conclusion:

  1. Manually starting in the Prometheus directory does not log to prometheus.log (possibly due to connection refusal).
  2. After pressing ctrl+c, the Prometheus process stops. Restarting Prometheus using tiup restores normal logging with log level=info.
| username: ShawnYan | Original post link

Does it mean that starting with debug reports an error, but starting with info is normal?

| username: Kongdom | Original post link

Does forcibly adding log.level in tiup cluster edit-config have any effect?

| username: buptzhoutian | Original post link

Maybe what you want is not logged.

However, the status of targets can be viewed in the Prometheus Web UI (http://IP:Port/targets).

Additionally, after the data is successfully scraped, it is written into tsdb, and you can directly write PromQL queries.

| username: TiDBer_小阿飞 | Original post link

log.level=debug

| username: 逍遥_猫 | Original post link

How can I see the historical data if this only shows the last one?

| username: 逍遥_猫 | Original post link

Where do I set it? How do I make the settings take effect?

| username: 逍遥_猫 | Original post link

The debug startup is manually starting Prometheus with a string of parameters, resulting in an error and not logging any messages. After stopping with ctrl+c, no errors are logged. This is not the same as starting with tiup cluster start tidb1 -R prometheus, and I haven’t found a way to pass parameters with this startup method.

| username: 逍遥_猫 | Original post link


Not allowed to add, using log-level: debug gives the same prompt.

| username: Kongdom | Original post link

:sweat_smile: It seems that only the command line can be used; the configuration file is not supported.

| username: buptzhoutian | Original post link

Historical data or historical state? Historical data has already been written into TSDB.

There’s no need to look at historical states, right?

If you want to know whether a certain target has been interrupted or during which time period there was no data, you can still see it through TSDB’s data.

| username: ShawnYan | Original post link

levle? Isn’t it level?

| username: heiwandou | Original post link

Is it in the startup script?

| username: TiDBer_小阿飞 | Original post link

Shouldn’t it be “level”? Is it “log-” or “log.”?

| username: 普罗米修斯 | Original post link

log.level is this

| username: dba远航 | Original post link

Use the tiup cluster edit-config command to edit the configuration file, and then reload.

| username: oceanzhang | Original post link

Change the log level in Prometheus

| username: Kongdom | Original post link

I tried it, and even with the correct spelling, it doesn’t allow adding. :joy: