@skyhook-io/k8s-ui 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils/log-format.ts +8 -0
package/package.json
CHANGED
package/src/utils/log-format.ts
CHANGED
|
@@ -272,12 +272,20 @@ export function escapeRegExp(text: string): string {
|
|
|
272
272
|
* K8s timestamps are in RFC3339Nano format: 2024-01-20T10:30:00.123456789Z content
|
|
273
273
|
*/
|
|
274
274
|
export function parseLogLine(line: string): { timestamp: string; content: string } {
|
|
275
|
+
// K8s timestamp prefix: "2026-03-19T00:01:19.811Z message..."
|
|
275
276
|
if (line.length > 30 && line[4] === '-' && line[7] === '-' && line[10] === 'T') {
|
|
276
277
|
const spaceIdx = line.indexOf(' ')
|
|
277
278
|
if (spaceIdx > 20 && spaceIdx < 40) {
|
|
278
279
|
return { timestamp: line.slice(0, spaceIdx), content: line.slice(spaceIdx + 1) }
|
|
279
280
|
}
|
|
280
281
|
}
|
|
282
|
+
// Structured JSON with "ts" or "timestamp" field
|
|
283
|
+
if (line[0] === '{') {
|
|
284
|
+
const tsMatch = line.match(/"(?:ts|timestamp|time)"\s*:\s*"(\d{4}-\d{2}-\d{2}T[^"]+)"/)
|
|
285
|
+
if (tsMatch) {
|
|
286
|
+
return { timestamp: tsMatch[1], content: line }
|
|
287
|
+
}
|
|
288
|
+
}
|
|
281
289
|
return { timestamp: '', content: line }
|
|
282
290
|
}
|
|
283
291
|
|