Skip to content

Commit ba9a230

Browse files
committed
feat(logs): Add Plex and Decypharr log parsing
This includes: - Adding `DECYPHARR` and `PLEX` service keys to the `SERVICE_KEY` enum. - Implementing `parsePlexLogs` and `parseDecypharrLogs` functions in `ServiceTypeLP.js` to handle the specific log formats. - Updating `serviceTypeLP` function to use the new parsing functions for these services. feat(apiURL): adds support for DUMB_API_URL chore(deps): updates dependencies
1 parent 828dc3b commit ba9a230

4 files changed

Lines changed: 2843 additions & 1738 deletions

File tree

constants/enums.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ export const SERVICE_KEY = {
33
DMB_FE: "dmb_frontend",
44
DUMB_API: "dumb_api_service",
55
DUMB_FE: "dumb_frontend",
6+
DECYPHARR: "decypharr",
67
CLI_DEBRID: "cli_debrid",
78
CLI_BATTERY: "cli_battery",
89
PHALANX_DB: "phalanx_db",
10+
PLEX: "plex",
911
PLEX_DEBRID: "plex_debrid",
1012
POSTGRESS: "postgres",
1113
PGADMIN: "pgadmin",

helper/ServiceTypeLP.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,68 @@ export function serviceTypeLP({ logsRaw, serviceKey, processName }) {
99
if (serviceKey === SERVICE_KEY.DMB_FE || serviceKey === SERVICE_KEY.DUMB_FE) return parseDMBLogs(logsRaw, processName)
1010
if (serviceKey === SERVICE_KEY.CLI_DEBRID) return parseCliDebridLogs(logsRaw, processName)
1111
if (serviceKey === SERVICE_KEY.CLI_BATTERY) return parseCliBatteryLogs(logsRaw, processName)
12+
if (serviceKey === SERVICE_KEY.PLEX) return parsePlexLogs(logsRaw, processName)
13+
if (serviceKey === SERVICE_KEY.DECYPHARR) return parseDecypharrLogs(logsRaw, processName);
1214
}
1315

16+
const parseDecypharrLogs = (logsRaw, processName) => {
17+
const lines = logsRaw.trim().split('\n');
18+
const parsedLogs = [];
19+
let currentEntry = null;
20+
const logLineRegex = /^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) \| (\w+)\s*\| \[(.*?)\] (.*)$/;
21+
22+
for (const line of lines) {
23+
const match = line.match(logLineRegex);
24+
25+
if (match) {
26+
if (currentEntry) parsedLogs.push(currentEntry);
27+
28+
const [, timestampStr, level, logProcess, message] = match;
29+
30+
currentEntry = {
31+
timestamp: new Date(timestampStr),
32+
level: level.trim(),
33+
process: logProcess.trim(),
34+
message: message.trim(),
35+
};
36+
} else if (currentEntry) {
37+
currentEntry.message += '\n' + line;
38+
}
39+
}
40+
41+
if (currentEntry) parsedLogs.push(currentEntry);
42+
return parsedLogs;
43+
};
44+
45+
const parsePlexLogs = (logsRaw, processName) => {
46+
const lines = logsRaw.trim().split('\n');
47+
const parsedLogs = [];
48+
let currentEntry = null;
49+
console.log('Parsing Plex logs for process:', processName);
50+
const logLineRegex = /^([A-Za-z]{3} \d{1,2}, \d{4} \d{2}:\d{2}:\d{2}(?:\.\d{3})?) \[\d+\] (\w+) - (.*)$/;
51+
52+
for (const line of lines) {
53+
const match = line.match(logLineRegex);
54+
if (match) {
55+
if (currentEntry) parsedLogs.push(currentEntry);
56+
57+
const [, timestampStr, level, message] = match;
58+
59+
currentEntry = {
60+
timestamp: new Date(timestampStr),
61+
level: level.trim(),
62+
process: processName.trim().replace(' subprocess', ''),
63+
message: message.trim(),
64+
};
65+
} else if (currentEntry) {
66+
currentEntry.message += '\n' + line;
67+
}
68+
}
69+
70+
if (currentEntry) parsedLogs.push(currentEntry);
71+
return parsedLogs;
72+
};
73+
1474
const parseRivenLogs = (logsRaw, processName) => {
1575
const lines = logsRaw.split('\n');
1676
const entries = [];

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@
1111
"postinstall": "nuxt prepare"
1212
},
1313
"dependencies": {
14-
"@material-symbols/font-400": "^0.29.1",
14+
"@material-symbols/font-400": "^0.29.3",
1515
"@parcel/watcher": "^2.5.1",
1616
"@pinia/nuxt": "^0.10.1",
17-
"@vueuse/core": "^13.0.0",
18-
"axios": "^1.8.3",
19-
"esbuild": "^0.25.1",
17+
"@vueuse/core": "^13.4.0",
18+
"axios": "^1.10.0",
19+
"esbuild": "^0.25.5",
2020
"floating-vue": "^5.2.2",
21-
"http-proxy-middleware": "^3.0.3",
21+
"http-proxy-middleware": "^3.0.5",
2222
"izitoast": "^1.4.0",
2323
"js-yaml": "^4.1.0",
2424
"json-editor-vue": "^0.18.1",
25-
"nuxt": "^3.16.0",
26-
"nuxt-svgo": "^4.0.17",
25+
"nuxt": "^3.17.5",
26+
"nuxt-svgo": "^4.2.2",
2727
"nuxt-toast": "1.1.4",
28-
"pinia": "^3.0.1",
29-
"vue": "^3.5.13",
30-
"vue-router": "^4.5.0",
28+
"pinia": "^3.0.3",
29+
"vue": "^3.5.17",
30+
"vue-router": "^4.5.1",
3131
"vue-screen": "^2.4.2"
3232
},
3333
"devDependencies": {
34-
"@nuxtjs/tailwindcss": "^6.13.2"
34+
"@nuxtjs/tailwindcss": "^6.14.0"
3535
},
3636
"engines": {
3737
"node": ">=22.14.0 <23",

0 commit comments

Comments
 (0)