toni-moreno / influxdb-srelay

Service to online route, filter, modify and replicate metrics from InfluxDB or prometheus sources to InfluxDB DB's

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

hanynowsky opened this issue · 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

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

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?

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

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

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

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 I've just test syncflux 0.6.7 on my kubernetes environment and it works like below:
image

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 thank you very much, and waiting for your newest version of influxdb-srelay

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 hello, above config is ok and can't effect on http_route_pass_all.log like below, sanme as syncflux(toni-moreno/syncflux#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

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

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"

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 I add log-inherit=true for each [[http.endpoint.route]] and there are 2 in my config
But still output log like above

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

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

@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