Metadata
The metadata field is where Astralog provides schema-less flexibility. It allows you to attach any custom context to your events without needing to run database migrations or define indexes beforehand.
- Dynamic Extraction: Astralog natively uses ClickHouse JSON functions to query these nested fields at lightning speed.
- High Cardinality: You can safely event fields with infinite unique values (like
ip_addressorsession_id) inside the metadata without suffering the “high cardinality explosion” that crashes systems like Prometheus.
Best Practice: Static Messages
Always keep your root message static and move variable data into the metadata object. This makes aggregations much faster and cleaner.
❌ Bad Pattern (High Cardinality Message):
{
"message": "User 123 failed to login from IP 192.168.1.1"
}
✅ Good Pattern (Static Message + Metadata):
{
"message": "User login failed",
"metadata": {
"user_id": "123",
"ip": "192.168.1.1"
}
}