Variables DestinationPort and DaysToLookBack
SELECT
strftime('%Y-%m-%dT%H:%M:%SZ', datetime(snj.time,'unixepoch')) dateTime,
u.username userName,
snj.sophosPID,
spj.processName processName,
CAST(spj.cmdline AS TEXT) cmdLine,
snj.source,
snj.sourcePort,
snj.destination,
snj.destinationPort,
snj.dataSent,
snj.dataRecv
FROM sophos_network_journal snj
LEFT JOIN sophos_process_journal spj USING (sophosPID)
LEFT JOIN users u ON spj.sid = u.uuid
WHERE snj.destinationPort LIKE '$$DestinationPort$$' AND snj.time > strftime('%s','NOW','-$$DaysToLookBack$$ days')