mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat(logs): improvements to searching
This commit is contained in:
@@ -55,10 +55,10 @@ export const setupDockerContainerLogsWebSocketServer = (
|
||||
.once("ready", () => {
|
||||
const baseCommand = `docker container logs --timestamps --tail ${tail} ${
|
||||
since === "all" ? "" : `--since ${since}`
|
||||
} --follow ${containerId}`;
|
||||
const command = search
|
||||
? `${baseCommand} 2>&1 | grep -iF '${search}'`
|
||||
: baseCommand;
|
||||
} --follow ${containerId}`;
|
||||
const command = search
|
||||
? `${baseCommand} 2>&1 | grep -iF '${search}'`
|
||||
: baseCommand;
|
||||
client.exec(command, (err, stream) => {
|
||||
if (err) {
|
||||
console.error("Execution error:", err);
|
||||
@@ -98,25 +98,18 @@ export const setupDockerContainerLogsWebSocketServer = (
|
||||
const shell = getShell();
|
||||
const baseCommand = `docker container logs --timestamps --tail ${tail} ${
|
||||
since === "all" ? "" : `--since ${since}`
|
||||
} --follow ${containerId}`;
|
||||
const command = search
|
||||
? `${baseCommand} 2>&1 | grep -iF '${search}'`
|
||||
: baseCommand;
|
||||
const ptyProcess = spawn(
|
||||
shell,
|
||||
[
|
||||
"-c",
|
||||
command,
|
||||
],
|
||||
{
|
||||
name: "xterm-256color",
|
||||
cwd: process.env.HOME,
|
||||
env: process.env,
|
||||
encoding: "utf8",
|
||||
cols: 80,
|
||||
rows: 30,
|
||||
},
|
||||
);
|
||||
} --follow ${containerId}`;
|
||||
const command = search
|
||||
? `${baseCommand} 2>&1 | grep -iF '${search}'`
|
||||
: baseCommand;
|
||||
const ptyProcess = spawn(shell, ["-c", command], {
|
||||
name: "xterm-256color",
|
||||
cwd: process.env.HOME,
|
||||
env: process.env,
|
||||
encoding: "utf8",
|
||||
cols: 80,
|
||||
rows: 30,
|
||||
});
|
||||
|
||||
ptyProcess.onData((data) => {
|
||||
ws.send(data);
|
||||
|
||||
@@ -55,9 +55,12 @@ export const setupDockerContainerLogsWebSocketServer = (
|
||||
new Promise<void>((resolve, reject) => {
|
||||
client
|
||||
.once("ready", () => {
|
||||
const command = `
|
||||
bash -c "docker container logs --timestamps --tail ${tail} ${since === "all" ? "" : `--since ${since}`} --follow ${containerId} | grep -iF '${search}'"
|
||||
`;
|
||||
const baseCommand = `docker container logs --timestamps --tail ${tail} ${
|
||||
since === "all" ? "" : `--since ${since}`
|
||||
} --follow ${containerId}`;
|
||||
const command = search
|
||||
? `${baseCommand} 2>&1 | grep -iF '${search}'`
|
||||
: baseCommand;
|
||||
client.exec(command, (err, stream) => {
|
||||
if (err) {
|
||||
console.error("Execution error:", err);
|
||||
@@ -87,21 +90,20 @@ export const setupDockerContainerLogsWebSocketServer = (
|
||||
});
|
||||
} else {
|
||||
const shell = getShell();
|
||||
const ptyProcess = spawn(
|
||||
shell,
|
||||
[
|
||||
"-c",
|
||||
`docker container logs --timestamps --tail ${tail} ${since === "all" ? "" : `--since ${since}`} --follow ${containerId} | grep -iF '${search}'`,
|
||||
],
|
||||
{
|
||||
name: "xterm-256color",
|
||||
cwd: process.env.HOME,
|
||||
env: process.env,
|
||||
encoding: "utf8",
|
||||
cols: 80,
|
||||
rows: 30,
|
||||
},
|
||||
);
|
||||
const baseCommand = `docker container logs --timestamps --tail ${tail} ${
|
||||
since === "all" ? "" : `--since ${since}`
|
||||
} --follow ${containerId}`;
|
||||
const command = search
|
||||
? `${baseCommand} 2>&1 | grep -iF '${search}'`
|
||||
: baseCommand;
|
||||
const ptyProcess = spawn(shell, ["-c", command], {
|
||||
name: "xterm-256color",
|
||||
cwd: process.env.HOME,
|
||||
env: process.env,
|
||||
encoding: "utf8",
|
||||
cols: 80,
|
||||
rows: 30,
|
||||
});
|
||||
|
||||
ptyProcess.onData((data) => {
|
||||
ws.send(data);
|
||||
|
||||
Reference in New Issue
Block a user