influxdb-srelay icon indicating copy to clipboard operation
influxdb-srelay copied to clipboard

Http access log is hard-coded to debug. Configuration log-level is useless

Open hanynowsky opened this issue 4 years ago • 18 comments

func NewHTTP(cfg *config.HTTPConfig) (*HTTP, error) {
        h := &HTTP{}
        h.cfg = cfg
        h.closing = make(chan bool, 1)
        //Log output

        h.log = utils.GetConsoleLogFormated(cfg.LogFile, cfg.LogLevel)
        //AccessLog Output

        h.acclog = utils.GetConsoleLogFormated(cfg.AccessLog, "debug")

        h.rp = cfg.DefaultRetentionPolicy

hanynowsky avatar Jan 24 '20 15:01 hanynowsky

I set warn for log level, but doesn't effect on access-log

like-inspur avatar May 01 '20 08:05 like-inspur

hello @hanynowsky @like-inspur it is hard coded as debug because of access.log has not levels its main goal is print each incoming query with related data.

If you need disable you can select /dev/null as output file to write to. Could yo test please? Why do you think this log could be annoyance and should be disabled in configuration time?

toni-moreno avatar May 01 '20 12:05 toni-moreno

because I run it on docker with image, if this log print forever, it will occupy docker disk in the future

like-inspur avatar May 02 '20 02:05 like-inspur

We could add a log option to redirect logs to the console... would you like this option better than separate files?

toni-moreno avatar May 02 '20 19:05 toni-moreno

We could add a log option to redirect logs to the console... would you like this option better than separate files?

certainly, and this will be bettern to watch service log under docker environment, and hope to modify this for syncflux also

like-inspur avatar May 03 '20 03:05 like-inspur

Hi @like-inspur , I've just released the syncflux 0.6.7 version wit default logmode on console , and other fixes and updates. Could you test it please? , If all ok, we will try to fix and release a new influxb-srelay version with this and other fixes ASAP. Thank you!

toni-moreno avatar May 03 '20 09:05 toni-moreno

@toni-moreno I've just test syncflux 0.6.7 on my kubernetes environment and it works like below: image

like-inspur avatar May 06 '20 02:05 like-inspur

it seems to be logging into the console ok.

NOTE: remember replication config "all" doesn't exist the correct config is "both" (ocumentation in previous versions was wrong)

toni-moreno avatar May 06 '20 05:05 toni-moreno

@toni-moreno thank you very much, and waiting for your newest version of influxdb-srelay

like-inspur avatar May 06 '20 07:05 like-inspur

Hello @like-inspur I've just reviewed code and remembered that code was ready to log into console by only omit all log-file and access-log paràmeters.

# HTTP Server
[[http]]
  name = "http-influxdb"
  bind-addr = "0.0.0.0:9096"
  log-file = ""
  log-level = "debug"
  access-log = ""

or

# HTTP Server
[[http]]
  name = "http-influxdb"
  bind-addr = "0.0.0.0:9096"
  log-level = "debug"

Could you test please?

toni-moreno avatar May 11 '20 20:05 toni-moreno

@toni-moreno hello, above config is ok and can't effect on http_route_pass_all.log like below, sanme as syncflux(https://github.com/toni-moreno/syncflux/issues/35), but output in console

root@mgt01:~# kubectl log influxdb-1 -n monitoring srelay
log is DEPRECATED and will be removed in a future version. Use logs instead.
{"level":"info","time":"2020-05-12T01:49:30Z","message":"trying to open log file /var/log/influxdb-srelay/http_route_pass_all.log ....."}
2020/05/12 01:49:30 starting relays...
2020/05/12 01:49:30 Running relay http-influxdbcluster...
2020-05-12 01:50:29 INF  bk_duration_ms=0.145692 duration_ms=0.167451 latency_ms=0.028479 method=GET referer= returnsize=4 source=10.110.19.68:47672 status=200 trace-route="http:http-influxdbcluster> " url=/health user=- user-agent=kube-probe/1.14 write-points=0 write-size=0
2020-05-12 01:50:33 INF  bk_duration_ms=0.187114 duration_ms=0.255529 latency_ms=0.074831 method=GET referer= returnsize=4 source=10.110.19.68:47744 status=200 trace-route="http:http-influxdbcluster> " url=/health user=- user-agent=kube-probe/1.14 write-points=0 write-size=0
2020-05-12 01:51:29 INF  bk_duration_ms=0.056033 duration_ms=0.066763 latency_ms=0.029602 method=GET referer= returnsize=4 source=10.110.19.68:48262 status=200 trace-route="http:http-influxdbcluster> " url=/health user=- user-agent=kube-probe/1.14 write-points=0 write-size=0
2020-05-12 01:51:33 INF  bk_duration_ms=0.04309 duration_ms=0.066816 latency_ms=0.029657 method=GET referer= returnsize=4 source=10.110.19.68:48308 status=200 trace-route="http:http-influxdbcluster> " url=/health user=- user-agent=kube-probe/1.14 write-points=0 write-size=0
2020-05-12 01:52:29 INF  bk_duration_ms=0.039261 duration_ms=0.060479 latency_ms=0.027422 method=GET referer= returnsize=4 source=10.110.19.68:48888 status=200 trace-route="http:http-influxdbcluster> " url=/health user=- user-agent=kube-probe/1.14 write-points=0 write-size=0
2020-05-12 01:52:33 INF  bk_duration_ms=0.044126 duration_ms=0.066866 latency_ms=0.029269 method=GET referer= returnsize=4 source=10.110.19.68:48918 status=200 trace-route="http:http-influxdbcluster> " url=/health user=- user-agent=kube-probe/1.14 write-points=0 write-size=0
2020-05-12 01:53:29 INF  bk_duration_ms=0.053366 duration_ms=0.086989 latency_ms=0.041293 method=GET referer= returnsize=4 source=10.110.19.68:49466 status=200 trace-route="http:http-influxdbcluster> " url=/health user=- user-agent=kube-probe/1.14 write-points=0 write-size=0
2020-05-12 01:53:33 INF  bk_duration_ms=0.078931 duration_ms=0.144222 latency_ms=0.071531 method=GET referer= returnsize=4 source=10.110.19.68:49524 status=200 trace-route="http:http-influxdbcluster> " url=/health user=- user-agent=kube-probe/1.14 write-points=0 write-size=0

like-inspur avatar May 12 '20 01:05 like-inspur

hi @like-inspur have you tested log-inherit=true on all route sections?

toni-moreno avatar May 12 '20 20:05 toni-moreno

yes, I config like below but still output http log like above

        [[http.endpoint.route]]
          name="pass_all"
          # level:
          #   * http => all following rules will work only with http params
          #   * data => any of the following rules will need data inspection
          level="http" # http or data
          #log-inhit
          # true => will use the endpoint log as this route log
          # false => will use its own log file ,  if not set the name <logdir>/http_route_<route_name>.log
          log-inherit = true
          #log-file = "query_route_linux_metrics.log"
          log-level = "warn"

like-inspur avatar May 13 '20 01:05 like-inspur

Hello @like-inspur , I've just reviewed code and tested the above described config and it is working to me.

Please check that you have void all your log-file entries and you have log-inherit=true in all your routes. I did it and all fine. ( 8 route entries one for each route)

# grep "\[\[http.endpoint.route\]\]" test/relay.devel.conf  | wc -l
8
 # grep "log-inherit" test/relay.devel.conf  | wc -l
8

please review and restart the process to test and let me know if finally fixed.

Thank you very much.

toni-moreno avatar May 16 '20 05:05 toni-moreno

@toni-moreno I add log-inherit=true for each [[http.endpoint.route]] and there are 2 in my config But still output log like above

like-inspur avatar May 16 '20 09:05 like-inspur

Please. Could you completely stop image, delete volumes and after restart again?

toni-moreno avatar May 16 '20 10:05 toni-moreno

@toni-moreno yes,I update configmap and restart pod again, not mount any volume for pod

like-inspur avatar May 18 '20 02:05 like-inspur

@toni-moreno hello, pod health check and prometheus write into influxdb log still always prrint like below 2020-09-04 06:28:38 INF bk_duration_ms=0.047086 duration_ms=0.06977 latency_ms=0.02909 method=GET referer= returnsize=4 source=10.110.19.68:43164 status=200 trace-route="http:http-influxdbcluster> " url=/health user=- user-agent=kube-probe/1.14 write-points=0 write-size=0 2020-09-04 06:27:27 INF bk_duration_ms=5.016989 duration_ms=6.828567 latency_ms=1.81905 method=POST referer= returnsize=0 source=100.101.63.105:51468 status=204 trace-route="http:http-influxdbcluster> rt:pass_all> decode:prom-write> rule:pass_all> " url=/write?db=prometheus user=- user-agent=Prometheus/2.15.2 write-points=100 write-size=25400

like-inspur avatar Sep 04 '20 06:09 like-inspur