[VOL-4237] Creating keyword to collect kubernetes components log
removing log-collector.sh from voltha-dt-physical-functional-tests.groovy

Change-Id: I09574c467a073096d9523a70c07910d9cd04c97a
diff --git a/vars/stopComponentsLogs.groovy b/vars/stopComponentsLogs.groovy
new file mode 100644
index 0000000..fc0f0e9
--- /dev/null
+++ b/vars/stopComponentsLogs.groovy
@@ -0,0 +1,27 @@
+// stops all the kail processes created by startComponentsLog
+
+def call(Map config) {
+
+    def defaultConfig = [
+        logsDir: "$WORKSPACE/logs",
+        compress: false, // wether to compress the logs in a tgz file
+    ]
+
+    def tag = "jenkins-"
+    println "Stopping all kail logging process"
+    sh """
+    P_IDS="$(ps e -ww -A | grep "_TAG=jenkins-kail" | grep -v grep | awk '{print $1}')"
+    if [ -n "$P_IDS" ]; then
+        for P_ID in $P_IDS; do
+            kill -9 $P_ID
+        done
+    fi
+    """
+    if (compress) {
+        sh """
+        tar czf ${logsDir}/combined.tgz *
+        rm *.log
+        """
+
+    }
+}
\ No newline at end of file