There isare a modulefew modules for that now DBLog Filter:
DBLOG FILTER module allows you to store only filtered db log messages based on log type and log level.
This module serves exactly this use case, by allowing you to enable Core's dblog module and define which log channel should be logged, and which can be dropped so that performances are maintained.