Logging to network share

Hi all,
After 840 odd days my Pi just up and died, at first I thought it might have been SD card but it Ethernet won’t fire up with a new SD card and won’t post any video either.

So I replaced it with a newer slightly improved model and put in a brand new vanilla imaged SD with PiAware 3.6.3 and all up and going again now.

Anyway one of the things I used to do on my old one was write out specific messages to a text file locally on the SD card, the concern above that I had worn the SD card out got me thinking. Could I write these out to a network share?

I have a Synology NAS with plenty of capacity and it supports NFS mounts too. Has anyone else tried doing this sort of thing?

Plan B was using a USB drive on the Pi, so if it died at least it was just the log files.

I was worried about that too. The thing is that a bigger card will take longer to wear out due to the antiwear mechanisms in the SD controller.
Also I have tried to increase the write-caching RAM, but I am not sure how successful:

Cache Adjust:
sudo sysctl -a | grep dirty

Initial settings:

vm.dirty_background_bytes = 0
vm.dirty_background_ratio = 10 > increase to 20
vm.dirty_bytes = 0
vm.dirty_expire_centisecs = 3000
vm.dirty_ratio = 20 > Increase to 40
vm.dirty_writeback_centisecs = 500
vm.dirtytime_expire_seconds = 43200

Edit:
sudo nano /etc/sysctl.conf

Add at the end:

vm.dirty_background_ratio = 20
vm.dirty_ratio = 40	

Restart.

Thanks for that, I have notice it is only writing out every 4KB or so anyway.

What I have found though is the follwoing article:

This worked nicely with the added bonus of being able to read the logs without having to log on to my Pi.

Hi,
I did an ftp script to write to the NAS - there I have a user ftpupload with limited rights
the following is in /usr/local/bin/getFAfiles.sh
and then added as cron job for root doing this every hour…

#!/bin/bash

#run with sudo

TMP=date +%Y%m%d-%H%M.gz
tar -czf /home/pi/fa-store/$TMP /run/dump1090-fa/

HOST=n3200pro.local
USER=ftpupload
PASSWORD=something…

ftp -inv $HOST <<EOF
user $USER $PASSWORD
binary
cd /PiUpload
lcd /home/pi/fa-store
put $TMP
bye
EOF

rm /home/pi/fa-store/$TMP

Gets you the raw data from /run/dump1090-fa logged on the NAS with files like: 20181130-1600.gz
You may ftp any data with this
Note: the password is in the script - so this is only usable in the local intranet.