I wrote a blog post that contains linux commands, config content, Set up Elecrow TTN LoRaWAN gateway on Raspberry Pi - Pt. 3: manage the service log size
The editor does not post the blog, with that content. As a workaround, I posted a screen capture of the content that it does not want to accept.
I'll attach the source code of the blog to this report, for debugging purpose.
Part that it doesn't accept:
The source of the full blog - that doesn't post:
<p>In part 1, [mention:798e586e5b4446f5bd42d7b107c09141:f7d226abd59f475c9d224a79e3f0ec07] , I compiled the software for the Elecrow LoRaWAN gateway (see [mention:700dcc1bc79f4f19b2be786fadc60e45:f7d226abd59f475c9d224a79e3f0ec07] ), and enabled the gateway on The Things Network (TTN). I used Raspberry OS bullseye 32-bit lite on a Raspberry Pi A+. I tested this on a B+ with the same OS too. In part 2, [mention:becc6c34c61543f0a5c5b854a7498ca1:f7d226abd59f475c9d224a79e3f0ec07] , the software gets properly installed, and I configure it as a <span style="font-family: 'courier new', courier;">systemd</span> service. In this 3rd post, a cleanup activity: manage the service's log file size.</p> <p>The log of the forwarder service can grow with several MB per day. If this is unmanaged, the Raspberry Pi will run out of disk space. You can check the size by running:</p> <p><span style="font-family: 'courier new', courier;">ls -lrt /var/log/lora_pkt_fwd.log</span></p> <p>Raspberry OS has a mechanism to handle log files: logrotate. This command is executed regularly, and can archive or delete logs. The utility is set up to handle several of the standard logs. Packages can add their log management, by adding a file to /etc/logrotate.d</p> <p><span style="font-family: 'courier new', courier;">sudo nano /etc/logrotate.d/lora_pkt_fwd</span></p> <p><code>/var/log/lora_pkt_fwd.log {</code><br /><code> weekly</code><br /><code> rotate 4</code><br /><code> missingok</code><br /><code> notifempty</code><br /><code> compress</code><br /><code> delaycompress</code><br /><code># nocreate</code><br /><code>}</code></p> <p>Then, you activate the added log config:</p> <p><span style="font-family: 'courier new', courier;">sudo logrotate /etc/logrotate.conf</span></p> <p>If you want, you can do a first run immediately:</p> <p><span style="font-family: 'courier new', courier;">sudo logrotate -f /etc/logrotate.conf</span></p> <p>and validate if all is good:</p> <p><span style="font-family: 'courier new', courier;">sudo logrotate -v /etc/logrotate.conf</span></p> <p><code>rotating pattern: /var/log/lora_pkt_fwd.log weekly (4 rotations)</code><br /><code>empty log files are not rotated, old logs are removed</code><br /><code>considering log /var/log/lora_pkt_fwd.log</code><br /><code> Now: 2024-01-08 23:33</code><br /><code> Last rotated at 2024-01-08 23:19</code><br /><code> log does not need rotating (log has already been rotated)</code></p> <p>Check the size of the log:</p> <p><span style="font-family: 'courier new', courier;"> ls -lrt /var/log/lora_pkt_fwd.log*</span></p> <p><span>If all is good, the system should now automatically weekly archive the log file, and keep the 4 latest archives.</span></p> <p></p>
Line 3 in the view above is the first one it doesn't want to accept. If I remove that line, there are next lines that prevent the forum from saving the content.
Easiest way to test:
- create new blog
- Tools -> Source Code
- copy-Paste the source code i attached
- close source window
- Try Tools -> Preview. It shows an empty page
- Try Save Draft or Publish. Nothing happens.