Use worker to log IP address and URI

I’m serving some larger text files from my origin server (6MB or so) to users who query them every hour. I’d like to create a worker to log every file request and record IP address and the URI. Then I’d like to query or download that data from a PHP script then clear the worker logs.
Is this possible and if so, how? Can I populate a KV store dynamically in a worker? And if so, how do I access that data from outside the worker?