Is there a way to keep a file stream entierly in memory?

81 Views Asked by At

I want to extract logs from journald on a embedded device running a yocto build. My current solution is using the sd-journal api to iteratively fetch all journal entries and sticking them into a fstream object. This object is then compressed using zlib, and finally uploaded to my ftp server using libcurl.

After an upload I need to remove the two files I have created: the original raw journal log (which can be up to 12 MB) and the compressed log. Is there a more pragmatic way for uploading entries from journald than I am doing here? Is it possible to create a file stream in memory, without it being written to disk?

0

There are 0 best solutions below