dcu / mongodb_exporter

MongoDB exporter for prometheus.io
MIT License
353 stars 216 forks source link

Add logRotate to mongodb_exporter #88

Open zhihuiFan opened 6 years ago

zhihuiFan commented 6 years ago

Hi @dcu Currently I'm using mongodb_expoerter in my environment, and I don't want to install too many agents. Now I want a feature to a different url path.

  1. allow a user to logRotate regularly. Like once per day
  2. configure a log retention policy so that the old log can be purged automatically.

I know it is not part of Prometheus agent, so I want to know if it is welcome to send such PR to this repo. Personally, I do want add it.

Thanks

avishefi commented 6 years ago

Prometheus exporters do not generate logs normally, what log do you want to configure & rotate?

zhihuiFan commented 6 years ago

The logs of mongodb, sometime it may take a lot of spaces

avishefi commented 6 years ago

Prometheus exporters expose metrics, they do not manage log files

sanvila commented 6 years ago

OP probably refers to all the stuff accumulating at /var/log/prometheus in the form prometheus-mongodb-exporter.MACHINE.TIMESTAMP. Those log files are generated by prometheus-mongodb-exporter and by default they take a lot of disk space.

I agree that it would be nice to have a procedure allowing the user to rotate those logs.

gao-jian-zz commented 6 years ago

my log file is named like mongodb_exporter.ip-10-72-229-205.ec2-user.log.INFO.20180502-212317.24179.

How to change the log level to others than INFO?

zjagust commented 5 years ago

OP probably refers to all the stuff accumulating at /var/log/prometheus in the form prometheus-mongodb-exporter.MACHINE.TIMESTAMP. Those log files are generated by prometheus-mongodb-exporter and by default they take a lot of disk space.

I agree that it would be nice to have a procedure allowing the user to rotate those logs.

Yeah, I'd like to know what and how generates those files. The largest one I have is aroung 350 MB and others are no less than 80 MB. Would be cool if there is some way to rotate/compress/purge old those file.

IntiGabriel commented 4 years ago

You can configure glog to log to stderr -logtostderr=true or log to another dir -log_dir="<ANOTHER_DIR>" to avoid filling up disk space. I need to redirect logs for long running containers.

More documentation for glog: https://godoc.org/github.com/golang/glog