How to syslog-ng execute shell script
Hello People, How to configure the syslog-ng.conf file, to call a shell script, for example to do zip file. It is possible to do this? Tks, William Luiz 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
Hi William, Yes it is possible: program source: https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edit... program destination: https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edit... hook-commands (for all sources and drivers with a few exceptions): https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edit... Is one of these actions suitable for you? What is the exact use case, when are you intending to run the script? Regards, Attila ________________________________ From: syslog-ng <syslog-ng-bounces@lists.balabit.hu> on behalf of William Luiz Ribeiro Vasconcelos Da Silva <wsilva_ericsson@timbrasil.com.br> Sent: Tuesday, December 3, 2019 9:17 PM To: syslog-ng@lists.balabit.hu <syslog-ng@lists.balabit.hu> Subject: [syslog-ng] 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. Hello People, How to configure the syslog-ng.conf file, to call a shell script, for example to do zip file. It is possible to do this? Tks, William Luiz 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
Attila, My goal is after the file generation by syslog-ng. Call a script to concatenate files in 1000 lines and after running gzip. Because the system that will collect these files expects the files to always be "zipped" and suffixed with .gzip Regards, William ________________________________ De: syslog-ng <syslog-ng-bounces@lists.balabit.hu> em nome de Attila Szakacs (aszakacs) <Attila.Szakacs@oneidentity.com> Enviado: quarta-feira, 4 de dezembro de 2019 06:24 Para: syslog-ng@lists.balabit.hu <syslog-ng@lists.balabit.hu> Assunto: Re: [syslog-ng] How to syslog-ng execute shell script Hi William, Yes it is possible: program source: https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.24/administration-guide/23#TOPIC-1297952<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.syslog-ng.com%2Ftechnical-documents%2Fdoc%2Fsyslog-ng-open-source-edition%2F3.24%2Fadministration-guide%2F23%23TOPIC-1297952&data=02%7C01%7Cwsilva_ericsson%40timbrasil.com.br%7C9fa8d544d77a461df8c308d7789bc668%7C57b8c96eac2f4d78a149f1fc6817d3c4%7C0%7C0%7C637110482782475600&sdata=yJgNouFssAPiUiyYKTapx63UNE8GiHTM%2F0YcKTpdsKU%3D&reserved=0> program destination: https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.24/administration-guide/43#TOPIC-1298032<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.syslog-ng.com%2Ftechnical-documents%2Fdoc%2Fsyslog-ng-open-source-edition%2F3.24%2Fadministration-guide%2F43%23TOPIC-1298032&data=02%7C01%7Cwsilva_ericsson%40timbrasil.com.br%7C9fa8d544d77a461df8c308d7789bc668%7C57b8c96eac2f4d78a149f1fc6817d3c4%7C0%7C0%7C637110482782475600&sdata=68K%2Faw7AK2dwSwzpw91ip3YaLaBNMCeje3IZPi7giw0%3D&reserved=0> hook-commands (for all sources and drivers with a few exceptions): https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.24/administration-guide/hook-commands<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.syslog-ng.com%2Ftechnical-documents%2Fdoc%2Fsyslog-ng-open-source-edition%2F3.24%2Fadministration-guide%2Fhook-commands&data=02%7C01%7Cwsilva_ericsson%40timbrasil.com.br%7C9fa8d544d77a461df8c308d7789bc668%7C57b8c96eac2f4d78a149f1fc6817d3c4%7C0%7C0%7C637110482782485592&sdata=fzi7OJBCdFwhcrQMueUMRwXUpTEpV9ZfZc2pdAt3H1s%3D&reserved=0> Is one of these actions suitable for you? What is the exact use case, when are you intending to run the script? Regards, Attila ________________________________ From: syslog-ng <syslog-ng-bounces@lists.balabit.hu> on behalf of William Luiz Ribeiro Vasconcelos Da Silva <wsilva_ericsson@timbrasil.com.br> Sent: Tuesday, December 3, 2019 9:17 PM To: syslog-ng@lists.balabit.hu <syslog-ng@lists.balabit.hu> Subject: [syslog-ng] 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. Hello People, How to configure the syslog-ng.conf file, to call a shell script, for example to do zip file. It is possible to do this? Tks, William Luiz 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
I believe you are looking for a logrotate functionality. Please correct me if I am wrong. There was a question in 2012 about it, let me give you a link to the answer: https://lists.balabit.hu/pipermail/syslog-ng/2012-April/018683.html Another thread about logrotate: https://github.com/syslog-ng/syslog-ng/pull/2798#issuecomment-553398341 You can add "compress" to the logrotate script, to run gzip on it. Although the logrotate config above is based on the size of the file, is that suitable for you? Regards, Attila ________________________________ From: syslog-ng <syslog-ng-bounces@lists.balabit.hu> on behalf of William Luiz Ribeiro Vasconcelos Da Silva <wsilva_ericsson@timbrasil.com.br> Sent: Wednesday, December 4, 2019 1:06 PM To: syslog-ng@lists.balabit.hu <syslog-ng@lists.balabit.hu> Subject: Re: [syslog-ng] 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, My goal is after the file generation by syslog-ng. Call a script to concatenate files in 1000 lines and after running gzip. Because the system that will collect these files expects the files to always be "zipped" and suffixed with .gzip Regards, William ________________________________ De: syslog-ng <syslog-ng-bounces@lists.balabit.hu> em nome de Attila Szakacs (aszakacs) <Attila.Szakacs@oneidentity.com> Enviado: quarta-feira, 4 de dezembro de 2019 06:24 Para: syslog-ng@lists.balabit.hu <syslog-ng@lists.balabit.hu> Assunto: Re: [syslog-ng] How to syslog-ng execute shell script Hi William, Yes it is possible: program source: https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.24/administration-guide/23#TOPIC-1297952<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.syslog-ng.com%2Ftechnical-documents%2Fdoc%2Fsyslog-ng-open-source-edition%2F3.24%2Fadministration-guide%2F23%23TOPIC-1297952&data=02%7C01%7Cattila.szakacs%40oneidentity.com%7Cb1aadada26af41352efd08d778b2682d%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637110580032260110&sdata=nMqPimY2F0EK0RzTohtNOfyFIqKqVpubg9Hf4c2wZlg%3D&reserved=0> program destination: https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.24/administration-guide/43#TOPIC-1298032<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.syslog-ng.com%2Ftechnical-documents%2Fdoc%2Fsyslog-ng-open-source-edition%2F3.24%2Fadministration-guide%2F43%23TOPIC-1298032&data=02%7C01%7Cattila.szakacs%40oneidentity.com%7Cb1aadada26af41352efd08d778b2682d%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637110580032270109&sdata=b90Xd8lyc%2BwbDwl6qf0N9pQONXbSRocbDnVXOGGFqds%3D&reserved=0> hook-commands (for all sources and drivers with a few exceptions): https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.24/administration-guide/hook-commands<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.syslog-ng.com%2Ftechnical-documents%2Fdoc%2Fsyslog-ng-open-source-edition%2F3.24%2Fadministration-guide%2Fhook-commands&data=02%7C01%7Cattila.szakacs%40oneidentity.com%7Cb1aadada26af41352efd08d778b2682d%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637110580032280100&sdata=%2FcDSd%2BOFLYFfM%2BwzWz%2FY2u2AxSJamx2GHi4jsuIlte0%3D&reserved=0> Is one of these actions suitable for you? What is the exact use case, when are you intending to run the script? Regards, Attila ________________________________ From: syslog-ng <syslog-ng-bounces@lists.balabit.hu> on behalf of William Luiz Ribeiro Vasconcelos Da Silva <wsilva_ericsson@timbrasil.com.br> Sent: Tuesday, December 3, 2019 9:17 PM To: syslog-ng@lists.balabit.hu <syslog-ng@lists.balabit.hu> Subject: [syslog-ng] 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. Hello People, How to configure the syslog-ng.conf file, to call a shell script, for example to do zip file. It is possible to do this? Tks, William Luiz 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
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
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@timbrasil.com.br> Sent: Thursday, December 5, 2019 2:30 PM To: Attila Szakacs (aszakacs) <Attila.Szakacs@oneidentity.com>; syslog-ng@lists.balabit.hu <syslog-ng@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
participants (2)
-
Attila Szakacs (aszakacs)
-
William Luiz Ribeiro Vasconcelos Da Silva