logs_commit4

This commit is contained in:
Mateusz Gruszczyński
2026-05-20 08:55:20 +02:00
parent 44ebb6afb0
commit 0a82211e4c
6 changed files with 490 additions and 10 deletions

View File

@@ -370,6 +370,9 @@
"jobs_total": {
"type": "integer"
},
"operation_logs_total": {
"type": "integer"
},
"planner_history_total": {
"type": "integer"
},
@@ -381,6 +384,9 @@
"jobs": {
"type": "integer"
},
"operation_logs": {
"type": "integer"
},
"planner_history": {
"type": "integer"
},
@@ -401,10 +407,26 @@
"retention_days",
"database",
"cache",
"planner_history_total"
"planner_history_total",
"operation_logs_total"
],
"type": "object"
},
"DeletedResponse": {
"allOf": [
{
"$ref": "#/components/schemas/ApiOk"
},
{
"properties": {
"deleted": {
"type": "integer"
}
},
"type": "object"
}
]
},
"FilePriorityRequest": {
"properties": {
"files": {
@@ -528,6 +550,262 @@
"additionalProperties": true,
"type": "object"
},
"OperationLogClearRequest": {
"properties": {
"event_type": {
"description": "Optional event type filter. Empty clears all active-profile operation logs.",
"type": "string"
}
},
"type": "object"
},
"OperationLogEntry": {
"properties": {
"action": {
"nullable": true,
"type": "string"
},
"created_at": {
"type": "string"
},
"details": {
"additionalProperties": true,
"type": "object"
},
"details_h": {
"type": "string"
},
"details_json": {
"type": "string"
},
"event_type": {
"type": "string"
},
"id": {
"type": "integer"
},
"message": {
"type": "string"
},
"profile_id": {
"nullable": true,
"type": "integer"
},
"severity": {
"type": "string"
},
"source": {
"type": "string"
},
"torrent_hash": {
"nullable": true,
"type": "string"
},
"torrent_name": {
"nullable": true,
"type": "string"
},
"user_id": {
"type": "integer"
}
},
"type": "object"
},
"OperationLogRetentionResult": {
"properties": {
"deleted": {
"type": "integer"
},
"deleted_days": {
"type": "integer"
},
"deleted_lines": {
"type": "integer"
},
"settings": {
"$ref": "#/components/schemas/OperationLogSettings"
}
},
"type": "object"
},
"OperationLogSettings": {
"properties": {
"created_at": {
"type": "string"
},
"profile_id": {
"type": "integer"
},
"retention_days": {
"maximum": 3650,
"minimum": 1,
"type": "integer"
},
"retention_lines": {
"maximum": 1000000,
"minimum": 100,
"type": "integer"
},
"retention_mode": {
"enum": [
"days",
"lines",
"both",
"manual"
],
"type": "string"
},
"updated_at": {
"type": "string"
},
"user_id": {
"type": "integer"
}
},
"type": "object"
},
"OperationLogSettingsRequest": {
"properties": {
"retention_days": {
"maximum": 3650,
"minimum": 1,
"type": "integer"
},
"retention_lines": {
"maximum": 1000000,
"minimum": 100,
"type": "integer"
},
"retention_mode": {
"enum": [
"days",
"lines",
"both",
"manual"
],
"type": "string"
}
},
"type": "object"
},
"OperationLogSettingsResponse": {
"allOf": [
{
"$ref": "#/components/schemas/ApiOk"
},
{
"properties": {
"retention": {
"$ref": "#/components/schemas/OperationLogRetentionResult"
},
"settings": {
"$ref": "#/components/schemas/OperationLogSettings"
}
},
"type": "object"
}
]
},
"OperationLogStats": {
"properties": {
"by_day": {
"items": {
"properties": {
"bucket": {
"type": "string"
},
"n": {
"type": "integer"
}
},
"type": "object"
},
"type": "array"
},
"by_month": {
"items": {
"properties": {
"bucket": {
"type": "string"
},
"n": {
"type": "integer"
}
},
"type": "object"
},
"type": "array"
},
"by_type": {
"items": {
"properties": {
"event_type": {
"type": "string"
},
"n": {
"type": "integer"
}
},
"type": "object"
},
"type": "array"
},
"settings": {
"$ref": "#/components/schemas/OperationLogSettings"
},
"top_actions": {
"items": {
"properties": {
"action": {
"type": "string"
},
"n": {
"type": "integer"
}
},
"type": "object"
},
"type": "array"
},
"total": {
"type": "integer"
}
},
"type": "object"
},
"OperationLogsResponse": {
"allOf": [
{
"$ref": "#/components/schemas/ApiOk"
},
{
"properties": {
"limit": {
"type": "integer"
},
"logs": {
"items": {
"$ref": "#/components/schemas/OperationLogEntry"
},
"type": "array"
},
"offset": {
"type": "integer"
},
"settings": {
"$ref": "#/components/schemas/OperationLogSettings"
},
"stats": {
"$ref": "#/components/schemas/OperationLogStats"
},
"total": {
"type": "integer"
}
},
"type": "object"
}
]
},
"PathBrowseResponse": {
"allOf": [
{
@@ -2636,7 +2914,7 @@
},
"/api/cleanup/all": {
"post": {
"description": "Clears finished job logs, Smart Queue history, Planner action history and automation history. Pending/running jobs, saved rules, settings and torrents are preserved.",
"description": "Clears finished job logs, Smart Queue history, active-profile operation logs, Planner action history and automation history. Pending/running jobs, saved rules, settings and torrents are preserved.",
"responses": {
"200": {
"content": {
@@ -2734,6 +3012,29 @@
"summary": "Clear finished job history"
}
},
"/api/cleanup/operation-logs": {
"post": {
"description": "Clears active-profile operation logs. Torrents, jobs, settings and rules are preserved.",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CleanupResponse"
}
}
},
"description": "Cleanup result"
}
},
"security": [
{
"sessionCookie": []
}
],
"summary": "Clear operation logs"
}
},
"/api/cleanup/planner": {
"post": {
"description": "Deletes Download Planner action history for the active profile. Saved Planner settings are preserved.",
@@ -3482,6 +3783,162 @@
"summary": "OpenAPI schema"
}
},
"/api/operation-logs": {
"get": {
"description": "Lists active-profile operation logs with filters, retention settings and statistics.",
"parameters": [
{
"in": "query",
"name": "limit",
"required": false,
"schema": {
"maximum": 1000,
"minimum": 1,
"type": "integer"
}
},
{
"in": "query",
"name": "offset",
"required": false,
"schema": {
"minimum": 0,
"type": "integer"
}
},
{
"in": "query",
"name": "type",
"required": false,
"schema": {
"type": "string"
}
},
{
"in": "query",
"name": "q",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OperationLogsResponse"
}
}
},
"description": "Operation logs"
}
},
"security": [
{
"sessionCookie": []
}
],
"summary": "List operation logs"
}
},
"/api/operation-logs/apply-retention": {
"post": {
"description": "Runs retention cleanup for active-profile operation logs.",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"allOf": [
{
"$ref": "#/components/schemas/ApiOk"
},
{
"$ref": "#/components/schemas/OperationLogRetentionResult"
}
]
}
}
},
"description": "Retention result"
}
},
"security": [
{
"sessionCookie": []
}
],
"summary": "Apply operation log retention"
}
},
"/api/operation-logs/clear": {
"post": {
"description": "Clears active-profile operation logs, optionally limited to one event type.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OperationLogClearRequest"
}
}
},
"required": false
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeletedResponse"
}
}
},
"description": "Deleted count"
}
},
"security": [
{
"sessionCookie": []
}
],
"summary": "Clear operation logs"
}
},
"/api/operation-logs/settings": {
"post": {
"description": "Saves active-profile operation log retention and applies it immediately.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OperationLogSettingsRequest"
}
}
},
"required": false
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OperationLogSettingsResponse"
}
}
},
"description": "Saved settings"
}
},
"security": [
{
"sessionCookie": []
}
],
"summary": "Save operation log retention settings"
}
},
"/api/path/browse": {
"get": {
"parameters": [