I wrote something similar that will send stdin to Google Stackdriver Logging. https://github.com/thesandlord/logpipe
For example, this uses datamash (https://www.gnu.org/software/datamash/) to sum column 2 of a CSV ("-t,"), then log the output:
datamash -t, sum 2