Too much History - or the logging problem

Well, I thought I had it figured out by now but no, sadly not.

Can someone point me to or explaine to me how I can limit what is saved and shown in my history? I have so many entities that loading is very slow and quite frankly it’s very unnessecery.

What I want:
I don’t want to see my Automations, Scripts and Persons in History
What I don’t want:
I still want to be able to look at traces and to check if an automation has been triggered the last few hours.

Is that even possible or can i only have it one way or the other? (Everything get’s saved vs. nothing get’s saved).


logger:
  default: warning
  logs:
    homeassistant.components.mqtt: info
    homeassistant.core: warning
    homeassistant.supervisor: warning
    sensor: info
    binary_sensor: info
    person: critical

This is clearly wrong but I’m not sure how else to it.

Do you mean Logbook? or your log file?

As for history, you can limit history through the history integration however that requires you to move away from default_config.

I don’t really care what is in the log file but I would prefere a slimmer logbook but most importantly fewer history entities.

if I move away from default_config, what would I have to explicitly add? I imagine removing it would remove the configurations for quite a lot of things. Is there some article I can read about it?

default config adds the current integrations listed in the default config integration.

You’ll have to list all those out by hand if you want it to contain everything in default config.

Then, on top of that, you’ll then configure logbook and history to display the information you want to display on those tabs. Keep in mind, that both of those integrations feed off recorder. So if you want to remove items from your database, you’ll have to maintain recorder as well. If you want it to record everything but only show specific items in history or logbook, you only need to maintain history or logbook.

Personally, I limit all 3 to be identical. This can be done by pointing all 3 at the same file. Here’s an example…

configuration.yaml

history: 
  include: !include history_include.yaml
  exclude: !include history_exclude.yaml
recorder:
  db_url: !secret recorder_url
  purge_keep_days: 32
  include: !include history_include.yaml
  exclude: !include history_exclude.yaml
logbook:
  include: !include history_include.yaml
  exclude: !include history_exclude.yaml

Then in your history_exclude…

entities:
  - light.test
  - light.test_1
  - light.test_2

or your history_include…

entities:
  - sensor.dryer_energy
  - sensor.dryer_power
domains:
  - light
  - switch
  - fan

That way, you only maintain 1 list for all 3. But if you want, you can maintain all 3 separately. They all use the same configuration method for including and excluding entities.

4 Likes

As always you are a lifesaver, petro.

This is exactly what i wa slooking for. For documentation we need to keep recording basically everything but we don’t actually have to SEE everything in logbook and History. This was bugging me SO much. Thank you, I’ll try this.

@petro
Hopping on here with a followup question. Hope that’s Ok. I am trying to implement a version of your using history_include.yaml and history_exclude.yaml. But running into a road block when trying to get things out of configuration.yaml
I am in the process of splitting up my config using packages. I have a folder structure under packages that seems to be working well so far. However trying to have recorder.yaml, logbook.yaml, and history.yaml reference the Include/exclude files is throwing errors along the line of

<history><history>

Sorry don’t have the actual error at this time. I can try to recreate if that helps.

I am guessing that my !includes are incorrect if the files ar not in the /config folder?
As an example I have /config/packages/logging And in /logging is where I would like history.yaml, logbook.yaml, and recorder.yaml to live.
Any ideas on proper syntax for this scenario?
Thanks and cheers!

On my configuration it’s not work :

entities:
  - sensor.date
  - sensor.date_time
  - sensor.time
  - sensor.time_utc
  - sensor.time_date
  - sensor.date_time
  - sensor.date_time_iso
  - sensor.date_time_utc
  - sensor.internet_time

saved in a file history_exclude.yaml (in the config folder)
and added in the really short configuration file the following lines:

logbook:
  exclude: !include history_exclude.yaml

recorder:
  exclude: !include history_exclude.yaml

That should work, just keep in mind, you have to restart after making changes like this.

yesssss,
sorry, but after testing and testing several scripts I always did a click on “Quick reload” not “restart…”
my bad.

Thank you !