Start Simple
Begin with basic rules. Keep rules simple and focused on what you need to detect.Always Validate & Test
Use validate and dry-run before deploying rules.Use Testing Directory for Development
Create new rules inrules/testing/ first, then test them with dry-run before moving to production:
-
Create rule in testing directory:
-
Test it safely:
-
Move to production when ready:
rules/testing/ are NEVER loaded in production (when running blocklight start). The dry-run command automatically includes them for testing purposes, ensuring you can test rules safely without generating alerts or affecting your monitoring system.
Caching
Caching is always enabled in Blocklight for optimal performance. Configure appropriate TTL values in analysis config based on your use case.Use Aggregation
Enable aggregation to reduce alert fatigue in high-volume scenarios.Reuse Components
Use lists and macros to keep rules maintainable. Important:lists and macros are defined at the file level (not inside rules), allowing you to create reusable building blocks that multiple rules in the same file can share.
Secure Your Secrets
Use${ENV_VARS} in alert configuration. Never commit secrets.