<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Old Management Server Logs Transfer using Cron Jobs in Firewall and Security Management</title>
    <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Old-Management-Server-Logs-Transfer-using-Cron-Jobs/m-p/52697#M86172</link>
    <description>&lt;P&gt;Thanks Nick,&lt;/P&gt;&lt;P&gt;What we wanted to copy are the checkpoint log files. Below sample files to be exact.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-rw-rw---- 1 admin root 614M Dec 14 2016 2016-12-14_143512.log&lt;BR /&gt;-rw-rw---- 1 admin root 157 Dec 14 2016 2016-12-14_143512.log_stats&lt;BR /&gt;-rw-rw---- 1 admin root 80 Nov 26 2016 2016-12-14_143512.logaccount_ptr&lt;BR /&gt;-rw-rw---- 1 admin root 20M Dec 14 2016 2016-12-14_143512.loginitial_ptr&lt;BR /&gt;-rw-rw---- 1 admin root 22M Dec 14 2016 2016-12-14_143512.logptr&lt;BR /&gt;-rw-rw---- 1 admin root 4.9M Dec 14 2016 2016-12-14_173332.log&lt;BR /&gt;-rw-rw---- 1 admin root 80 Dec 14 2016 2016-12-14_173332.logaccount_ptr&lt;BR /&gt;-rw-rw---- 1 admin root 152K Dec 14 2016 2016-12-14_173332.loginitial_ptr&lt;BR /&gt;-rw-rw---- 1 admin root 165K Dec 14 2016 2016-12-14_173332.logptr&lt;/P&gt;&lt;DIV class="lia-message-author-avatar lia-component-author-avatar lia-component-message-view-widget-author-avatar"&gt;&lt;DIV class="UserAvatar lia-user-avatar"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-message-author-with-avatar"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Mon, 06 May 2019 14:18:30 GMT</pubDate>
    <dc:creator>Silvan_Nyambu</dc:creator>
    <dc:date>2019-05-06T14:18:30Z</dc:date>
    <item>
      <title>Old Management Server Logs Transfer using Cron Jobs</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Old-Management-Server-Logs-Transfer-using-Cron-Jobs/m-p/52676#M86170</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;I wanted to setup scheduled log transfer on R77.30 or R80.20 management server using cron jobs if possible. The script should be able to check for three months old log files, transfer them to an offsite SFTP/FTP storage box and after the transfer is complete the files are deleted from the management server to create space.&lt;/P&gt;&lt;P&gt;Currently I mostly use WinSCP to copy the files manually and I was looking for a way that I can use to automate the process.&lt;/P&gt;&lt;P&gt;Does anyone have an Idea of how I can use cron jobs to achieve this? Kindly advise.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 10:02:42 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Old-Management-Server-Logs-Transfer-using-Cron-Jobs/m-p/52676#M86170</guid>
      <dc:creator>Silvan_Nyambu</dc:creator>
      <dc:date>2019-05-06T10:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: Old Management Server Logs Transfer using Cron Jobs</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Old-Management-Server-Logs-Transfer-using-Cron-Jobs/m-p/52683#M86171</link>
      <description>&lt;P&gt;Hi Silvan,&lt;/P&gt;&lt;P&gt;The first thing you would need to do is to identify the exact log files big enough to consume excessive amounts of disk space. The reason for that is that you don't want to accidentally delete any files you might need. You can identify the correct files by starting with df -h and then carry on analysing each partition recursively as outlined on&amp;nbsp;&lt;SPAN&gt;sk60080. For the purpose of clarity, we will assume that the logs you want to delete are inside the /var/log directory (though again you would need to be as specific as possible).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The script you could start with could have the following form:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;==========Script===============&lt;/P&gt;&lt;P&gt;#!/bin/bash&lt;/P&gt;&lt;P&gt;#Find log files inside the /var/log directory that are at least three months old and store those files in a #text file.&lt;BR /&gt;find /var/log -type f -mtime +90 2&amp;gt; /dev/null &amp;gt; log_files_to_transfer.txt&lt;/P&gt;&lt;P&gt;#Send all of the files found to the remote log server via sftp.&lt;BR /&gt;for file in log_files_to_transfer.txt; do&lt;BR /&gt;echo put $file | sftp -b- offsite-storage-box:path&lt;BR /&gt;done&lt;/P&gt;&lt;P&gt;#Find log files inside the /var/log directory that are at least three months old and delete them.&lt;BR /&gt;find /var/log -type f -mtime +90 2&amp;gt; /dev/null -exec rm -f {} \;&lt;BR /&gt;exit 0&lt;/P&gt;&lt;P&gt;==============================&lt;/P&gt;&lt;P&gt;Below are some instructions on how to use the above script:&lt;/P&gt;&lt;P&gt;1) Store the script inside the /bin/sh directory.&lt;/P&gt;&lt;P&gt;2) Make the script executable:&lt;/P&gt;&lt;P&gt;chmod u+x /bin/sh/log_transfer.sh&lt;/P&gt;&lt;P&gt;3) Edit the crontab file:&lt;/P&gt;&lt;P&gt;- crontab -e&lt;BR /&gt;- Press Shift+G to get to the bottom of the file followed by pressing o to move down one more line and get into insert mode as well.&lt;/P&gt;&lt;P&gt;4) To set up the cron job, type the following:&lt;/P&gt;&lt;P&gt;0 22 * * * /bin/sh/log_transfer.sh&lt;/P&gt;&lt;P&gt;5) To exit the crontab file:&lt;/P&gt;&lt;P&gt;- Press Escape&lt;BR /&gt;- Type :wq to save and exit&lt;/P&gt;&lt;P&gt;The purpose of this script is to find logs inside the /var/log directory older than 30 days, sftp them to a remote server and then delete the said logs. It would be run every day at 10pm (outside production hours). You can obviously adjust it to another frequency if you wish.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;****Again, please note that the above script is just a template to start from as you need to be very specific as to which logs to delete. You don't want to delete any files that might prove to be critical.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 11:36:07 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Old-Management-Server-Logs-Transfer-using-Cron-Jobs/m-p/52683#M86171</guid>
      <dc:creator>Nick_Doropoulos</dc:creator>
      <dc:date>2019-05-06T11:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Old Management Server Logs Transfer using Cron Jobs</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Old-Management-Server-Logs-Transfer-using-Cron-Jobs/m-p/52697#M86172</link>
      <description>&lt;P&gt;Thanks Nick,&lt;/P&gt;&lt;P&gt;What we wanted to copy are the checkpoint log files. Below sample files to be exact.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-rw-rw---- 1 admin root 614M Dec 14 2016 2016-12-14_143512.log&lt;BR /&gt;-rw-rw---- 1 admin root 157 Dec 14 2016 2016-12-14_143512.log_stats&lt;BR /&gt;-rw-rw---- 1 admin root 80 Nov 26 2016 2016-12-14_143512.logaccount_ptr&lt;BR /&gt;-rw-rw---- 1 admin root 20M Dec 14 2016 2016-12-14_143512.loginitial_ptr&lt;BR /&gt;-rw-rw---- 1 admin root 22M Dec 14 2016 2016-12-14_143512.logptr&lt;BR /&gt;-rw-rw---- 1 admin root 4.9M Dec 14 2016 2016-12-14_173332.log&lt;BR /&gt;-rw-rw---- 1 admin root 80 Dec 14 2016 2016-12-14_173332.logaccount_ptr&lt;BR /&gt;-rw-rw---- 1 admin root 152K Dec 14 2016 2016-12-14_173332.loginitial_ptr&lt;BR /&gt;-rw-rw---- 1 admin root 165K Dec 14 2016 2016-12-14_173332.logptr&lt;/P&gt;&lt;DIV class="lia-message-author-avatar lia-component-author-avatar lia-component-message-view-widget-author-avatar"&gt;&lt;DIV class="UserAvatar lia-user-avatar"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-message-author-with-avatar"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 06 May 2019 14:18:30 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Old-Management-Server-Logs-Transfer-using-Cron-Jobs/m-p/52697#M86172</guid>
      <dc:creator>Silvan_Nyambu</dc:creator>
      <dc:date>2019-05-06T14:18:30Z</dc:date>
    </item>
  </channel>
</rss>

