michele-follo
4/13/2016 - 3:26 PM

BCO Utils - Archive all logs/output for a given ETL and day

BCO Utils - Archive all logs/output for a given ETL and day

# Archive all logs by taks id (file it from etl/log/)
tar czvf selfMonitoringLogs_2016-04-11.tar.gz $(grep -l task.id=38 * | xargs ls -l | grep "Apr 11" | grep Q4B  | awk '{print $9}')

# Archive all output files by taskid (file it from etl/output/)
tar czvf selfMonitoringOutputs_2016-04-11.tar.gz $(grep -l task.id=38 /opt/cpit/etl/log/* | xargs ls -l | grep "Apr 11" | awk '{print $9}' | xargs grep -Po "/opt/cpit/etl/output/.*" | tr ' ;' '\n\n' | grep -oE '[^/]+$' | sort -u)