I’ve created a logchain called bcl.
I want to add logs from Mac OS to logchain.
The log record is working like this :
POST /data_logs/new
curl -X POST -H “Content-Type: application/json” -d ‘{
“log_data”: “YOUR_LOG_DATA”
}’ “http://[2a01:cb06:3d0:c400:a94b:e054:ef67:4034]:8080/data_logs/new”
—
The script I use for uploading the log(line) is called bcl.sh here is it :
#!/bin/sh
# Retrieve the machine UUID on macOS using ioreg
machine_uuid=$(ioreg -rd1 -c IOPlatformExpertDevice | awk -F" '/IOPlatformUUID/ { print $4 }')
while IFS= read -r line
do
curl -X POST -H "Content-Type: application/json" -d "{"log_data": "$machine_uuid - $line"}" http://SERVER-IP:LISTENING-PORT/data_logs/new
done
I tried log stream | sh bcl.sh
but it has a lot of output so I tried to do a script macOsLogSend.sh like this
while true
do
log show --last 1m | sh bcl.sh
sleep 1m
done
not sure that 1m works in sh but I can try with sleep 60 instead what do you think ?