fix: logging
This commit is contained in:
parent
e9e6449edf
commit
f75af035bb
@ -472,17 +472,20 @@ export const saveBuildLog = async ({
|
|||||||
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
console.debug(`[${applicationId}] ${addTimestamp}`);
|
console.debug(`[${applicationId}] ${addTimestamp}`);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return await got.post(`${fluentBitUrl}/${applicationId}_buildlog_${buildId}.csv`, {
|
||||||
|
json: {
|
||||||
|
line: encrypt(line)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch(error) {
|
||||||
return await prisma.buildLog.create({
|
return await prisma.buildLog.create({
|
||||||
data: {
|
data: {
|
||||||
line: addTimestamp, buildId, time: Number(day().valueOf()), applicationId
|
line: addTimestamp, buildId, time: Number(day().valueOf()), applicationId
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return await got.post(`${fluentBitUrl}/${applicationId}_buildlog_${buildId}.csv`, {
|
|
||||||
json: {
|
|
||||||
line: encrypt(line)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||||
import { day } from '$lib/dayjs';
|
import { day } from '$lib/dayjs';
|
||||||
import { selectedBuildId } from '$lib/store';
|
import { selectedBuildId } from '$lib/store';
|
||||||
|
|
||||||
let logs: any = [];
|
let logs: any = [];
|
||||||
let currentStatus: any;
|
let currentStatus: any;
|
||||||
let streamInterval: any;
|
let streamInterval: any;
|
||||||
@ -43,11 +43,13 @@
|
|||||||
status,
|
status,
|
||||||
fromDb: from
|
fromDb: from
|
||||||
} = await get(`/applications/${id}/logs/build/${$selectedBuildId}?sequence=${sequence}`);
|
} = await get(`/applications/${id}/logs/build/${$selectedBuildId}?sequence=${sequence}`);
|
||||||
|
|
||||||
currentStatus = status;
|
currentStatus = status;
|
||||||
logs = logs.concat(
|
logs = logs.concat(
|
||||||
responseLogs.map((log: any) => ({ ...log, line: cleanAnsiCodes(log.line) }))
|
responseLogs.map((log: any) => ({ ...log, line: cleanAnsiCodes(log.line) }))
|
||||||
);
|
);
|
||||||
fromDb = from;
|
fromDb = from;
|
||||||
|
|
||||||
streamInterval = setInterval(async () => {
|
streamInterval = setInterval(async () => {
|
||||||
if (status !== 'running' && status !== 'queued') {
|
if (status !== 'running' && status !== 'queued') {
|
||||||
clearInterval(streamInterval);
|
clearInterval(streamInterval);
|
||||||
@ -60,7 +62,8 @@
|
|||||||
);
|
);
|
||||||
status = data.status;
|
status = data.status;
|
||||||
currentStatus = status;
|
currentStatus = status;
|
||||||
|
fromDb = data.fromDb;
|
||||||
|
|
||||||
logs = logs.concat(
|
logs = logs.concat(
|
||||||
data.logs.map((log: any) => ({ ...log, line: cleanAnsiCodes(log.line) }))
|
data.logs.map((log: any) => ({ ...log, line: cleanAnsiCodes(log.line) }))
|
||||||
);
|
);
|
||||||
|
@ -3,6 +3,7 @@ version: '3.8'
|
|||||||
services:
|
services:
|
||||||
fluent-bit:
|
fluent-bit:
|
||||||
image: coollabsio/coolify-fluent-bit:1.0.0
|
image: coollabsio/coolify-fluent-bit:1.0.0
|
||||||
|
command: /fluent-bit/bin/fluent-bit -c /fluent-bit/etc/fluent-bit-dev.conf
|
||||||
container_name: coolify-fluentbit
|
container_name: coolify-fluentbit
|
||||||
volumes:
|
volumes:
|
||||||
- ./logs:/logs
|
- ./logs:/logs
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
FROM fluent/fluent-bit:1.9.8
|
FROM fluent/fluent-bit:1.9.8
|
||||||
COPY ./fluent-bit.conf /fluent-bit/etc/fluent-bit.conf
|
COPY ./fluent-bit.conf /fluent-bit/etc/fluent-bit.conf
|
||||||
|
COPY ./fluent-bit-dev.conf /fluent-bit/etc/fluent-bit-dev.conf
|
||||||
COPY ./parsers.conf /fluent-bit/etc/parsers.conf
|
COPY ./parsers.conf /fluent-bit/etc/parsers.conf
|
30
others/fluentbit/fluent-bit-dev.conf
Normal file
30
others/fluentbit/fluent-bit-dev.conf
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
[SERVICE]
|
||||||
|
Parsers_file /fluent-bit/etc/parsers.conf
|
||||||
|
Flush 1
|
||||||
|
Grace 30
|
||||||
|
[INPUT]
|
||||||
|
Name http
|
||||||
|
Host 0.0.0.0
|
||||||
|
Port 24224
|
||||||
|
[FILTER]
|
||||||
|
Name parser
|
||||||
|
Match *
|
||||||
|
Key_Name log
|
||||||
|
Parser jsonparser
|
||||||
|
Reserve_Data True
|
||||||
|
[OUTPUT]
|
||||||
|
Name file
|
||||||
|
Match *
|
||||||
|
Path /logs
|
||||||
|
Mkdir true
|
||||||
|
Format csv
|
||||||
|
# [OUTPUT]
|
||||||
|
# Name influxdb
|
||||||
|
# match *
|
||||||
|
# Host coolify-influxdb
|
||||||
|
# Port 8086
|
||||||
|
# Database coolify
|
||||||
|
# Bucket coolify
|
||||||
|
# Org coolify
|
||||||
|
# HTTP_Token 12345678
|
||||||
|
# Sequence_Tag _seq
|
@ -10,7 +10,7 @@
|
|||||||
Name parser
|
Name parser
|
||||||
Match *
|
Match *
|
||||||
Key_Name log
|
Key_Name log
|
||||||
Parser docker
|
Parser jsonparser
|
||||||
Reserve_Data True
|
Reserve_Data True
|
||||||
[OUTPUT]
|
[OUTPUT]
|
||||||
Name file
|
Name file
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[PARSER]
|
[PARSER]
|
||||||
Name docker
|
Name jsonparser
|
||||||
Format json
|
Format json
|
||||||
Time_Key time
|
Time_Key time
|
||||||
Time_Format %Y-%m-%dT%H:%M:%S.%L
|
Time_Format %Y-%m-%dT%H:%M:%S.%L
|
||||||
|
Loading…
x
Reference in New Issue
Block a user