[syslog-ng] How to syslog-ng execute shell script

Attila Szakacs (aszakacs) Attila.Szakacs at oneidentity.com
Tue Dec 10 08:27:20 UTC 2019


Hi,

Example syslog-ng config:
@version: 3.24
@include "scl.conf"

source s_local {
  example-msg-generator(freq(0.2));
};
destination d_file {
  file("/home/alltilla/Work/install/OSE/files/file.txt");
};
log {
  source(s_local);
  destination(d_file);
};

Example logrotate config:
/home/alltilla/Work/install/OSE/files/file.txt {
  rotate 8
  size 1k
  postrotate
    /home/alltilla/Work/install/OSE/sbin/syslog-ng-ctl reload
  endscript
  compress
  missingok
}

Running logrotate every 2 seconds:
$ logrotate etc/logrotate.conf -s var/status.tmp

Files outputted:
-rw------- 1 alltilla 1,6K dec   10 09:23 file.txt
-rw------- 1 alltilla  109 dec   10 09:23 file.txt.1.gz
-rw------- 1 alltilla  109 dec   10 09:23 file.txt.2.gz
-rw------- 1 alltilla  109 dec   10 09:23 file.txt.3.gz
-rw------- 1 alltilla  111 dec   10 09:23 file.txt.4.gz
-rw------- 1 alltilla  108 dec   10 09:22 file.txt.5.gz
-rw------- 1 alltilla  109 dec   10 09:22 file.txt.6.gz
-rw------- 1 alltilla  104 dec   10 09:22 file.txt.7.gz
-rw------- 1 alltilla  103 dec   10 09:22 file.txt.8.gz

Regards,
Attila
________________________________
From: William Luiz Ribeiro Vasconcelos Da Silva <wsilva_ericsson at timbrasil.com.br>
Sent: Thursday, December 5, 2019 2:30 PM
To: Attila Szakacs (aszakacs) <Attila.Szakacs at oneidentity.com>; syslog-ng at lists.balabit.hu <syslog-ng at lists.balabit.hu>
Subject: RE: How to syslog-ng execute shell script

CAUTION: This email originated from outside of the organization. Do not follow guidance, click links, or open attachments unless you recognize the sender and know the content is safe.

Attila,


I believe there would be no problem with the file size.

You would have an example of how to use this logrotate. so that you can "gzip" the generated files?


Regards,
William

Esta mensagem, incluindo seus anexos, pode conter informações privilegiadas e/ou de caráter confidencial, não podendo ser retransmitida sem autorização do remetente. Se você não é o destinatário ou pessoa autorizada para recebê-la, informamos que o seu uso, divulgação, cópia ou arquivamento são proibidos. Portanto, se você recebeu esta mensagem por engano, por favor nos informe respondendo imediatamente a este e-mail e delete o seu conteúdo.

This message, including its attachments, may contain privileged or confidential information, and it must not be fowarded without the express authorization of the sender. If you are not the intended recipient, we hereby inform you that the use, disclosure, copy or filing are forbidden. So, if you received this message as a mistake, please inform us by answering this e-mail and deleting its contents

Questo messaggio, inclusi gli allegati, potrebbe contenere informazioni privilegiate e/o riservate, e non deve essere ritrasmesse senza l'autorizzazione del mittente. Se non siete il destinatario o la persona autorizzata a riceverlo, informiamo che il suo utilizzo, diffusione, copia o archiviazione sono proibite. Quindi, se avete ricevuto questo messaggio per errore, per cortesia ci informi rispondendo immediatamente a questa email e cancelli il suo contenuto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20191210/060f4852/attachment.html>


More information about the syslog-ng mailing list