Custom configuration
TOC:
Flask App Configuration Hooks
FLASK_APP_MUTATOR
is a configuration function that can be provided in your environment, receives the app object and can alter it in any way. For example, add FLASK_APP_MUTATOR
into your spotrix_config.py
to setup session cookie expiration time to 24 hours:
SECRET_KEY Rotation
If you want to rotate the SECRET_KEY(change the existing secret key), follow the below steps.
Add the new SECRET_KEY and PREVIOUS_SECRET_KEY to spotrix_config.py
:
Then run spotrix re-encrypt-secrets
.
Event Logging
Spotrix by default logs special action events in its internal database (DBEventLogger). These logs can be accessed on the UI by navigating to Security > Action Log. You can freely customize these logs by implementing your own event log class. When custom log class is enabled DBEventLogger is disabled and logs stop being populated in UI logs view. To achieve both, custom log class should extend built-in DBEventLogger log class.
Here's an example of a simple JSON-to-stdout class:
End by updating your config to pass in an instance of the logger you want to use:
StatsD Logging
Spotrix can be instrumented to log events to StatsD if desired. Most endpoints hit are logged as well as key events like query start and end in SQL Lab.
To setup StatsD logging, it’s a matter of configuring the logger in your spotrix_config.py
.
Note that it’s also possible to implement your own logger by deriving spotrix.stats_logger.BaseStatsLogger
.
Last updated