user6851498
user6851498

Reputation:

Prevent unwanted logs in heroku

I have successfully deployed a production-level app in heroku. Now I'm working on logging and monitoring.

Unfortunately, I cannot find a way to control what is being logged in heroku logs, papertrail, etc. Every 1 or 2 minutes, I get the following kind of messages:

app/heroku-postgres source=DATABASE addon=postgresql-slippery-76303 
sample#current_transaction=1408 sample#db_size=11563679bytes 
sample#tables=24 sample#active-connections=13 sample#waiting- 
connections=0 sample#index-cache-hit-rate=0.99834 sample#table-cache- 
hit-rate=0.99896 sample#load-avg-1m=0.01 sample#load-avg-5m=0.005 
sample#load-avg-15m=0 sample#read-iops=0 sample#write-iops=0.098361 
sample#tmp-disk-used=33849344 sample#tmp-disk-available=72944943104 
sample#memory-total=4044932kB sample#memory-free=1741488kB 
sample#memory-cached=1968548kB sample#memory-postgres=44600kB

I found out the documentation page from heroku about that:

https://devcenter.heroku.com/articles/heroku-postgres-metrics-logs

They forgot to tell, though, how can I disable these postgres metrics logs.

In general, I would like to filter what get's logged, because heroku has a limit of logged lines and I wanted to log only what is useful for me. So, if I wanted to disable all logs coming from a specific program, like app/heroku-postgres, I would like to have the option to do so.

Is it there a way in heroku to configure this?

Upvotes: 1

Views: 1166

Answers (1)

RangerRanger
RangerRanger

Reputation: 2493

These log lines are not configurable from Heroku's side. Presumably, that's because this is one of the few ways you're able to observe the health of your database host. Heroku maintains a minimal log buffer for you and instead expect that you'll configure your own logging addon, many are free. It's possible that some of these same addons could potentially filter/drop on regex. That being said, it's probably not wise to drop those log lines if you care at all about monitoring your database.

Upvotes: 1

Related Questions