Skip to content

Commit 94faf78

Browse files
authored
Merge pull request #2758 from NeoIsRecursive/fix/match-multi-line-log-messages
fix: match multi line log messages
2 parents c435148 + 1b77c80 commit 94faf78

File tree

1 file changed

+2
-2
lines changed
  • apps/dokploy/components/dashboard/docker/logs

1 file changed

+2
-2
lines changed

apps/dokploy/components/dashboard/docker/logs/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function parseLogs(logString: string): LogLine[] {
4949
// { timestamp: new Date("2024-12-10T10:00:00.000Z"),
5050
// message: "The server is running on port 8080" }
5151
const logRegex =
52-
/^(?:(\d+)\s+)?(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z|\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3} UTC)?\s*(.*)$/;
52+
/^(?:(?<lineNumber>\d+)\s+)?(?<timestamp>(?:\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z|\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3} UTC))?\s*(?<message>[\s\S]*)$/;
5353

5454
return logString
5555
.split("\n")
@@ -59,7 +59,7 @@ export function parseLogs(logString: string): LogLine[] {
5959
const match = line.match(logRegex);
6060
if (!match) return null;
6161

62-
const [, , timestamp, message] = match;
62+
const { timestamp, message } = match.groups ?? {};
6363

6464
if (!message?.trim()) return null;
6565

0 commit comments

Comments
 (0)