Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can show the log on console? #12443

Closed
yue6121 opened this issue Jun 28, 2018 · 10 comments
Closed

how can show the log on console? #12443

yue6121 opened this issue Jun 28, 2018 · 10 comments

Comments

@yue6121
Copy link

yue6121 commented Jun 28, 2018

  • What Grafana version are you using? 5.1.3
  • What datasource are you using? Elasticsearch
  • What OS are you running grafana on? Ubuntu 16.04
  • What problem?
    how can show the log on console?
#################################### Logging ##########################
[log]
# Either "console", "file", "syslog". Default is console and  file
# Use space to separate multiple modes, e.g. "console file"
mode = console file

# Either "debug", "debug", "warn", "error", "critical", default is "debug"
level = debug

# optional settings to set different levels for specific loggers. Ex filters = sqlstore:debug
filters =

# For "console" mode only
[log.console]
level = debug

# log line format, valid options are text, console and json
format = console

# For "file" mode only
[log.file]
level = debug

# log line format, valid options are text, console and json
format = text

# This enables automated log rotate(switch of following options), default is true
log_rotate = true

# Max line number of single file, default is 1000000
max_lines = 1000000

I want to see client.go log with debug on console?but how ?I can not see these messages below.

	clientLog.Debug("Executing multisearch", "search requests", len(r.Requests))

	multiRequests := c.createMultiSearchRequests(r.Requests)
	res, err := c.executeBatchRequest("_msearch", multiRequests)
	if err != nil {
		return nil, err
	}

	clientLog.Debug("Received multisearch response", "code", res.StatusCode, "status", res.Status, "content-length", res.ContentLength)

	start := time.Now()
	clientLog.Debug("Decoding multisearch json response")

	var msr MultiSearchResponse
	defer res.Body.Close()
	dec := json.NewDecoder(res.Body)
	err = dec.Decode(&msr)
	if err != nil {
		return nil, err
	}

	elapsed := time.Now().Sub(start)
	clientLog.Debug("Decoded multisearch json response", "took", elapsed)
@marefr
Copy link
Member

marefr commented Jun 28, 2018

You'll need to upgrade to Grafana v5.2.0 first since Elasticsearch backend implementation was introduced there.

@marefr marefr closed this as completed Jun 28, 2018
@yue6121
Copy link
Author

yue6121 commented Jun 29, 2018

thank you , now I uphrade to Grafana V5.2.0 already. I build it with source code, I want to debug the backend code, I had config the .ini file with debug level ,but I can not see the debug message on console, I need some help now , thanks.

@yue6121
Copy link
Author

yue6121 commented Jun 29, 2018

I build grafana with source code,now I want to debug the backend code, I had config the .ini file with debug level ,but I can not see the debug message on console, I need some help now , thanks.
11

the backend is run by bra run
22

Can you tell me how to do? Thank you!

@marefr
Copy link
Member

marefr commented Jun 29, 2018

The elasticsearch backend code is only executed for evaluating alert rules at the moment. When you render graphs in Grafana the frontend code is solely used. We want to change this eventually and make it solely a backend implementation, but no idea of when this will happen.

@yue6121
Copy link
Author

yue6121 commented Jul 2, 2018

I set level=debug in .ini file, bug the debug messages were not print on console?

@marefr
Copy link
Member

marefr commented Jul 2, 2018

How are you executing your elasticsearch queries? Thru alerting? As I wrote earlier you wont get any debug messages if you only render a graph in Grafana UI since the backend elasticsearch is not in play then.

@yue6121
Copy link
Author

yue6121 commented Jul 2, 2018

not alerting. Only query data from es.
popo 201872205145

@yue6121
Copy link
Author

yue6121 commented Jul 2, 2018

did client.go work when I query data from es?
img20180702_204706

@marefr
Copy link
Member

marefr commented Jul 2, 2018

Please read my comments. You wont get any debug messages if you only render a graph in Grafana UI. You need to create an alert rule and when that alert rule is evaluated the backend elasticsearch code will be executed and you'll see debug log messages.

@yue6121
Copy link
Author

yue6121 commented Jul 3, 2018

I got it, Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants