If you have the wherewithall to run a `bash` script this will maintain a file counter and use it to create an circular sequence of `dmesg` log files.
#!/bin/bash
dir=/path/to/storage # Location of persistent storage
[[ -z "$dir/count" ]] && echo 0 >"$dir/count" # Seed the counter if missing
while sleep 0.25
do
count=$(( $(cat "$dir/count") +1 )) # Read the counter and increment
[[ $count -gt 600 ]] && count=1 # Reset so we can reuse diskspace
echo $count >"$dir/count" # Save the new value
dmesg >"$dir/dmesg.$count" # Write the data
done
You will need to review the resulting set of up to 600 log files in date-modified order (`ls -t`) because they will be written and rewritten like a circular buffer.