fix(ogcore): corregir sistema journal-pull para máquinas con journal activo #120
|
|
@ -6,10 +6,10 @@ Wants=network-online.target
|
|||
[Service]
|
||||
User=systemd-journal-remote
|
||||
Group=systemd-journal-remote
|
||||
ExecStartPre=/bin/sh -c 'f=/var/log/journal/remote/%i.journal; [ -f "$f" ] && journalctl --file="$f" -n 1 --no-pager 2>/dev/null | grep -q "." || rm -f "$f"'
|
||||
ExecStart=/usr/lib/systemd/systemd-journal-remote --url=http://%i:19531/entries?SYSLOG_IDENTIFIER=ogcore&SYSLOG_IDENTIFIER=oggui&SYSLOG_IDENTIFIER=ogdhcp&SYSLOG_IDENTIFIER=ogboot&SYSLOG_IDENTIFIER=ogrepo-api&SYSLOG_IDENTIFIER=ogrepo-api_DEBUG&SYSLOG_IDENTIFIER=kea-dhcp4&SYSLOG_IDENTIFIER=kea-ctrl-agent&SYSLOG_IDENTIFIER=DhcpLFC&SYSLOG_IDENTIFIER=kea-dhcp6&SYSLOG_IDENTIFIER=tftpd-hpa&SYSLOG_IDENTIFIER=%%28smbd%%29&SYSLOG_IDENTIFIER=%%28nmbd%%29 --split-mode=none --output=/var/log/journal/remote/%i.journal
|
||||
ExecStartPre=/bin/mkdir -p /var/log/journal/remote/%i
|
||||
ExecStart=/usr/lib/systemd/systemd-journal-remote --url=http://%i:19531/entries?boot=0&SYSLOG_IDENTIFIER=ogcore&SYSLOG_IDENTIFIER=oggui&SYSLOG_IDENTIFIER=ogdhcp&SYSLOG_IDENTIFIER=ogboot&SYSLOG_IDENTIFIER=ogrepo-api&SYSLOG_IDENTIFIER=ogrepo-api_DEBUG&SYSLOG_IDENTIFIER=kea-dhcp4&SYSLOG_IDENTIFIER=kea-ctrl-agent&SYSLOG_IDENTIFIER=DhcpLFC&SYSLOG_IDENTIFIER=kea-dhcp6&SYSLOG_IDENTIFIER=tftpd-hpa&SYSLOG_IDENTIFIER=%%28smbd%%29&SYSLOG_IDENTIFIER=%%28nmbd%%29 --split-mode=host --output=/var/log/journal/remote/%i/
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
RestartSec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
|||
|
|
@ -39,15 +39,15 @@ class DiskLogsAction extends AbstractController
|
|||
$args = ['--no-pager', '--output=json', sprintf('-n %d', $lines)];
|
||||
|
||||
if ($host) {
|
||||
// Host remoto: leer del fichero journal nombrado por IP
|
||||
$journalFile = sprintf('%s/%s.journal', self::REMOTE_JOURNAL_DIR, $host);
|
||||
if (!file_exists($journalFile)) {
|
||||
// Host remoto: leer del directorio journal nombrado por IP
|
||||
$journalDir = sprintf('%s/%s', self::REMOTE_JOURNAL_DIR, $host);
|
||||
if (!is_dir($journalDir)) {
|
||||
return new JsonResponse(
|
||||
['error' => sprintf('No se encontró el journal para el host %s', $host)],
|
||||
Response::HTTP_NOT_FOUND
|
||||
);
|
||||
}
|
||||
$args[] = sprintf('--file=%s', escapeshellarg($journalFile));
|
||||
$args[] = sprintf('--directory=%s', escapeshellarg($journalDir));
|
||||
}
|
||||
|
||||
// Múltiples SYSLOG_IDENTIFIER se pasan como matches separados → journalctl los aplica con OR
|
||||
|
|
|
|||
Loading…
Reference in New Issue