{% extends "base.html" %} {% block title %}Audit Logs - AuthKit Admin{% endblock %} {% block extra_css %} .search-card { background: rgba(23, 28, 41, 0.45); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border-color); border-radius: 12px; padding: 1.25rem; margin-bottom: 2rem; display: flex; flex-direction: column; gap: 1rem; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); } .search-input-wrapper { position: relative; width: 100%; } .search-input-wrapper input { padding-left: 2.75rem; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-color); transition: all 0.25s ease; } .search-input-wrapper input:focus { border-color: var(--accent-purple); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); background: rgba(0, 0, 0, 0.4); } .search-icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-secondary); pointer-events: none; font-size: 1rem; } .filter-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; } .filter-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-right: 0.5rem; } .filter-chip { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-color); color: var(--text-secondary); padding: 0.4rem 1rem; border-radius: 20px; font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; user-select: none; } .filter-chip:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); } .filter-chip.active { background: var(--primary-glow); color: white; border-color: transparent; box-shadow: 0 4px 12px rgba(168, 85, 247, 0.25); } /* Table elements */ .action-badge { padding: 0.25rem 0.6rem; border-radius: 6px; font-size: 0.75rem; font-family: monospace; font-weight: 600; display: inline-block; } .action-auth { background: rgba(139, 92, 246, 0.15); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.25); } .action-fail { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.25); } .action-sys { background: rgba(6, 182, 212, 0.15); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.25); } .action-default { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); border: 1px solid var(--border-color); } /* Inspect Button */ .btn-inspect { background: rgba(6, 182, 212, 0.08); color: var(--accent-cyan); border: 1px solid rgba(6, 182, 212, 0.2); padding: 0.35rem 0.75rem; border-radius: 6px; font-family: inherit; font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; display: inline-flex; align-items: center; gap: 0.35rem; } .btn-inspect:hover { background: var(--accent-cyan); color: black; box-shadow: 0 0 10px rgba(6, 182, 212, 0.35); } /* User Agent Styles */ .ua-info { display: flex; flex-direction: column; gap: 0.15rem; } .ua-main { color: var(--text-primary); font-size: 0.85rem; font-weight: 500; } .ua-sub { color: var(--text-secondary); font-size: 0.75rem; } /* Syntax Highlighting */ .json-key { color: #f472b6; font-weight: 500; } .json-string { color: #34d399; } .json-number { color: #60a5fa; } .json-boolean { color: #fbbf24; } .json-null { color: #9ca3af; font-style: italic; } {% endblock %} {% block content %}

System Audit Trails

Monitor real-time user events, administrative actions, and security logs.

🔍
Quick Filters:
All
Logins
Logouts
Admin Actions
Failures & Errors
{% if not logs %} {% endif %} {% for log in logs %} {% endfor %}
Timestamp User Action IP Address User Agent Metadata
No audit logs found.
{{ log.created_at.strftime('%Y-%m-%d %H:%M:%S') }} {{ log.user.email if log.user else 'Anonymous' }} {% set act = log.action %} {% if 'login' in act or 'logout' in act or 'register' in act %} {{ act }} {% elif 'fail' in act or 'error' in act or 'revoke' in act or 'deactivate' in act %} {{ act }} {% elif 'admin' in act or 'config' in act %} {{ act }} {% else %} {{ act }} {% endif %} {{ log.ip_address or 'Unknown' }} {% set ua = log.user_agent or '' %} {% set os = 'Unknown OS' %} {% if 'Windows' in ua %}{% set os = 'Windows' %} {% elif 'Macintosh' in ua or 'Mac OS' in ua %}{% set os = 'macOS' %} {% elif 'iPhone' in ua or 'iPad' in ua %}{% set os = 'iOS' %} {% elif 'Android' in ua %}{% set os = 'Android' %} {% elif 'Linux' in ua %}{% set os = 'Linux' %} {% endif %} {% set browser = 'Unknown Browser' %} {% if 'Chrome' in ua %}{% set browser = 'Chrome' %} {% elif 'Safari' in ua and 'Chrome' not in ua %}{% set browser = 'Safari' %} {% elif 'Firefox' in ua %}{% set browser = 'Firefox' %} {% elif 'Edge' in ua or 'Edg' in ua %}{% set browser = 'Edge' %} {% endif %}
{{ os }} • {{ browser }}
{% if log.details %} {% else %} {% endif %}
{% endblock %} {% block extra_js %} {% endblock %}