Arduino Pixhawk MAVLink messages save in onboard log?

Hey all,
I have following problem:
I have a rotary encoder which is communicating via SPI and I want to store this information at the data log for flight analysis. Therefore I have an arduino due connected to the sensors and a Pixhawk4.
So far, I was able to connect the Arduino with the Pixhawk via MAVLink (following the post of Juan Pedro: https://discuss.ardupilot.org/search?q=flash%20topic%3A25566).
I also used mavlink_msg_param_value to send some test data to the pixhawk (either if I am not sure if this is the right way of doing it). I am using MissionPlaner as GCS and in the Mavlink Inspector i am able to see my additional component and my inside PARAM_VALUE my test data.

Now to my question is:
Is their a possibility to store the sended MAVLink messages (and therefor also the sensor data) to the flashlog on the onboard Sd-card?

For me this would be a really nice solution because then I also could add even more custom sensors to the arduino ad store their data without the need of implementing new drivers in the firmware (which I am not able to, due to my bad programming skills :/…)
The other solution for me is to request all data from the pixhawk via MAVLink and store it on an addtional external sd-card on the arduino. Which seems to me like a huge work around…

Did anyone have an idea how to solve it? Thanks in advance!

(PS: Since I am quite new to ardupilot and programming in general I hope I did not messed up with terminology etc… )

Here I have a short sketch of the SetUp:
ArduinoPixhawkMavlink

I know this is an old thread, but I am facing a similar problem to you. I found this post regarding storing data on an SD card to be promising;

Regarding the test data that you were able to see in Mission Planner, how exactly did you do that? I am attempting to do the same thing with QGroundControl but none of the messages I have sent have appeared in the MAVLink inspector or on the log. I’ve tried sending param_value, raw_gps, raw_imu, and data_log messages.