Cross-app audit and analytics logging for Locaria Intelligence Layer
Project description
il-audit — Intelligence Layer audit & analytics
Cross-app BigQuery audit logging for intelligence-layer-ingest and intelligence-layer-chat.
Install
Local dev (sibling repo):
pip install -e ../intelligence-layer-audit
Production pin (PyPI, after release):
"il-audit>=0.1.0",
Or from Git:
"il-audit @ git+https://github.com/Locaria/intelligence-layer-audit@v0.1.0",
See PUBLISHING.md for release → PyPI workflow (same as locaria-integrated-testing).
Configuration
All defaults live in bundled JSON — never hardcode prices or dataset names in application code.
| File | Purpose |
|---|---|
il_audit/data/audit_defaults.json |
Dataset, flush tuning, default cost_rates_source |
il_audit/data/cost_rates_seed.json |
Interim pricing catalog (until BQ cost_rates is scraped) |
il_audit/cost_catalog.py |
Stable service/operation/resource identifier constants |
| Variable | Default (from JSON) | Purpose |
|---|---|---|
IL_ENABLE_AUDIT_LOGS |
true |
Master switch (also respects IL_ENABLE_BQ_LOGS) |
IL_BQ_AUDIT_DATASET |
intelligence_layer_logs |
BQ dataset |
IL_BQ_LOGS_PROJECT |
— | GCP project (GOOGLE_CLOUD_PROJECT / GCP_PROJECT fallback) |
IL_COST_RATES_SOURCE |
seed |
seed or bigquery (authoritative catalog from cost_rates table) |
IL_COST_RATES_CACHE_SECONDS |
3600 |
In-memory rate cache TTL |
IL_AUDIT_STORE_QUERY_TEXT |
true |
Store full chat questions in BQ |
When IL_COST_RATES_SOURCE=bigquery, rates load from {project}.{dataset}.cost_rates. A scheduled-tasks job will scrape GCP pricing docs and maintain that table. Until then, seed JSON is used and rows are tagged pricing_source=seed_catalog.
Usage
from il_audit import AuditContext, emit
from il_audit import taxonomy as T
emit(
T.AUTH_LOGIN_SUCCEEDED,
context=AuditContext(app="ingest", actor_uid=uid, actor_email=email),
status="succeeded",
action="login",
)
Chat adoption (phase 2)
- Add same
il-auditdep to chat - Mount
create_beacon_router(app_name="chat", get_context=...) - Emit
chat_turnsonPOST /querywith clientconversation_session_id - See
documentation/chat-phase2.md
SQL
Operator-run views: sql/analytics_views.sql
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file il_audit-0.1.0.tar.gz.
File metadata
- Download URL: il_audit-0.1.0.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e5bea77dda74359374e69496cc5e35d780da4e41b6dbbf6ed53e685ff407767
|
|
| MD5 |
d43e59914bc15ba1dcf0570528e517d9
|
|
| BLAKE2b-256 |
6843ffd6ec40b6d177996c10eae6d4d571404a42163cee517ba4e63e7d383bda
|
File details
Details for the file il_audit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: il_audit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44f5e1946da2ccad5dd5b58c74c03ebfd2db423ea61500ba0c96880b674fc3f4
|
|
| MD5 |
737085064bbaecb81e2e53f00ebea4ef
|
|
| BLAKE2b-256 |
6f053dfbc388386134ecc424b49902e9a2723c45a51d9cc19de8ae8db61ffb62
|