Regular expression: What is correct syntax for the new logger filter on Google TTS

trying to filter these messages:

2021-05-07 12:27:46 ERROR (MainThread) [homeassistant.components.tts] Error on load tts: 9a7redacted342_nl_-_google_translate not in cache!

would this be the correct syntax?:

filters:
  homeassistant.components.tts:
    - 'Error on load tts: *google_translate not in cache!'

I might even only need the last bit: '*_google_translate not in cache!' ?

Also, do I need the dot: 'Error on load tts: .*. google_translate not in cache!' ?

I am not certain on the wildcard bit, as displayed here in the docs

also, in the same example in the docs: what exactly does "^Error handling request$" mean/do?
please have a look? thanks

btw, tried to check it at RegexPlanet: online regular expression testing for Python, but dont think this will test if a reg ex checks for a given string like the error above

You should read up on regular expressions. It’s a syntax that properly matches text and each symbol means something different.

https://docs.python.org/3/library/re.html

it’s using the re.search method so all you really need is: 'google_translate not in cache'

thanks, will do…

I feared using only a substring without further wildcards on either side would not match.
btw, would it make any efficiency difference if I only use the starting sequence ‘Error on load tts:’ ?

or with wildcard: ‘Error on load tts:.’

re.search traverse the string, it doesn’t require a full match. If you want a full match, you need to learn regex and all the symbols. There are no ‘wildcards’, it’s not as simple as grep. You have to specifically tell it what to search for and how many times, etc. Also, throw out everything you know about wildcards/grep because it does not translate to regex.

on another integration: homeassistant.loader, can’t we filter this?

  homeassistant.loader:
    -  'We found a custom integration'

also tried:

  homeassistant.loader:
    - 'you experience issues with Home Assistant'

I’d love to filter this pointless disclaimer out of the log…

It’s the same answer as above…

EDIT: Check the message in the logs and check what you wrote… you’ll notice they differ.

my eyes must be failing me then, because this is one of the error lines:

2021-06-04 15:35:13 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration browser_mod which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

and I copied the exact last few words of that line. Isnt that what we did above with the google_translate?

Odd, mine is different. Maybe it’s a translated string

Although, I am using Lovelace gen which might affect the loader

Maybe because I use 6.0rc2 operating system?

Anyways, how to proceed? Maybe the loader can’t be filtered because the necessary integration for filtering isn’t loaded yet :wink:

Yeah that’s possible, I’m not at home to try. I’ll give it a whirl when I am home

ok thanks, interested to learn the differences, and if you can make it happen

update:

we cant filter those messages: Discord

ludeeus:

no, those warnings are printed before the logger integration is loaded

Which is the same reason that and The custom integration 'xxxx' does not have a valid version key (None) in the manifest file and was blocked from loading. See https://developers.home-assistant.io/blog/2021/01/29/custom-integration-changes#versions for more details is only in the log file and not in the UI

1 Like

I’m still interested in why your message differs from mine.

forgot to ask… sorry. but here’s the definitive answer:

Odd, I’m running the nightly. The heads probably aren’t in sync.