Keeping a log of all user interactions on Streamlit app

In my streamlit app, the user can perform SQL like operations like group-by, filtering, and also the ability to plot the result.
I would like them to be able to download the plots in a zip file, perhaps which a log (txt file) that shows the operations for each plot (ie, any filters they applied).
Is it possible to save the plots to a zip buffer as they get generated?
I’d also like the zip buffer to be cleared once they refresh the browser. BTW, when a user refreshes the browser, does Streamlit starts fresh (ie, clears cache data, etc)? I feel that’s not the case.