<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Logrotate on Ajo Mathew</title><link>https://blog.ajomathew.dev/tags/logrotate/</link><description>Recent content in Logrotate on Ajo Mathew</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><lastBuildDate>Tue, 08 May 2018 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.ajomathew.dev/tags/logrotate/rss.xml" rel="self" type="application/rss+xml"/><item><title>Linux Log Rotate and archive rotated file.</title><link>https://blog.ajomathew.dev/posts/2018-05-08-linux-log-rotate-and-archive-rotated-file/</link><pubDate>Tue, 08 May 2018 00:00:00 +0000</pubDate><guid>https://blog.ajomathew.dev/posts/2018-05-08-linux-log-rotate-and-archive-rotated-file/</guid><description>&lt;p&gt;I was checking an article on how to upload archived logs to azure blob.
As initial set up I&amp;rsquo;ve updated logrotate.conf(&lt;code&gt;/etc/logrotate.conf&lt;/code&gt;) with below settings.&lt;/p&gt;
&lt;h4 id="file-to-edit"&gt;file to edit:&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;/etc/logrotate.conf&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;{% gist 5d2a8a1bf8cb0f619b45a39785dee395 %}&lt;/p&gt;
&lt;p&gt;Then updated syslog rotate config to test on how messages files can be archived. Make sure the destination path is created. In this case I&amp;rsquo;ve got &lt;code&gt;/opt/logs/&lt;/code&gt; referenced.
&lt;em&gt;file edited&lt;/em&gt;
&lt;code&gt;/opt/logrotate.d/syslog&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;{% gist bacb68f7f66e346d1d80f2a934c00856 %}&lt;/p&gt;
&lt;p&gt;This will ensure the last rotated log file would be copied to /opt/logs/. You can have any other scripts configured to upload to blob from here.
Once these settings are in place test run(force run) &lt;em&gt;logrotate -f /etc/logrotate.conf&lt;/em&gt;.
Result of the operation can be found below&lt;/p&gt;</description></item></channel></rss>