Collect rbe execution stats before build times out

This CL makes sure:
1) if a build finishes successfully within a normal range, collect rbe logs after
2) if a build takes longer than a predefined latency (default 30mins), collect rbe logs proactively after the latency without failing the build.

LED for 1)
https://ci.chromium.org/raw/build/logs.chromium.org/flutter/led/keyonghan_google.com/525e6a08e3cdcec9ce7b0ca1d8e586b0752745e8cf972d8fcc84758ff3344664/+/build.proto?server=chromium-swarm.appspot.com (collect logs after the build finishes in step 23)
LED for 2)
https://ci.chromium.org/raw/build/logs.chromium.org/flutter/led/keyonghan_google.com/a38b16b8e82f789eea5f8fce03fe9d77265c381e0f6781df699f8c42e7e1db5b/+/build.proto?server=chromium-swarm.appspot.com (collect logs when the build execution time exceeds 60s - see step 23, with a latency of 60s)(See also step 24 where the logs are also collected when the build step finishes)

Change-Id: I03f4c973d299c52f0307f0e500b30712e4753b35
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/54521
Commit-Queue: Keyong Han <keyonghan@google.com>
Reviewed-by: Yusuf Mohsinally <mohsinally@google.com>
Reviewed-by: Ricardo Amador <ricardoamador@google.com>
diff --git a/recipe_modules/build_util/api.py b/recipe_modules/build_util/api.py
index fba9c65..a8603b6 100644
--- a/recipe_modules/build_util/api.py
+++ b/recipe_modules/build_util/api.py
@@ -7,6 +7,9 @@
 
 from recipe_engine import recipe_api
 
+# The default latency (seconds) to collect RBE logs.
+COLLECT_RBE_LOGS_LATENCY_SECS = 1800
+
 
 class BuildUtilApi(recipe_api.RecipeApi):
   """Gn and Ninja wrapper functions."""
@@ -77,8 +80,11 @@
     rbe_jobs = self.m.properties.get('rbe_jobs') or self._calculate_j_value()
     ninja_args = [tool, '-j', rbe_jobs, '-C', build_dir]
     ninja_args.extend(targets)
-    with self.m.rbe(working_path=rbe_working_path
-                   ), self.m.depot_tools.on_path():
+    with self.m.rbe(
+        working_path=rbe_working_path,
+        collect_rbe_logs_latency=self.m.properties.get(
+            'collect_rbe_logs_latency',
+            COLLECT_RBE_LOGS_LATENCY_SECS)), self.m.depot_tools.on_path():
       name = 'build %s' % ' '.join([config] + list(targets))
       self.m.step(name, ninja_args)
 
diff --git a/recipe_modules/build_util/examples/full.expected/basic.json b/recipe_modules/build_util/examples/full.expected/basic.json
index e8b6f16..9875f79 100644
--- a/recipe_modules/build_util/examples/full.expected/basic.json
+++ b/recipe_modules/build_util/examples/full.expected/basic.json
@@ -563,6 +563,155 @@
   },
   {
     "cmd": [],
+    "name": "collect rbe logs"
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/bootstrap.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read bootstrap.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@bootstrap.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/rbe_metrics.txt",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read rbe_metrics.txt",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rbe_metrics.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read reproxy.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy-gomaip.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read reproxy-gomaip.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy_outerr.log",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read reproxy_outerr.log",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_outerr.log@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/rewrapper.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read rewrapper.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rewrapper.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "glob",
+      "[CLEANUP]/rbe",
+      "*.rrpl"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.find rrpl files",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
+      "@@@STEP_LOG_END@glob@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
+    ]
+  },
+  {
+    "cmd": [],
     "name": "install infra/rbe/client"
   },
   {
@@ -723,6 +872,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution.collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -749,9 +905,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read bootstrap.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -782,9 +938,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read rbe_metrics.txt",
+    "name": "teardown remote execution.collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -815,9 +971,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -848,9 +1004,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -881,9 +1037,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy_outerr.log",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -914,9 +1070,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read rewrapper.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -947,9 +1103,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.find rrpl files",
+    "name": "teardown remote execution.collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -981,9 +1137,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
     ]
   },
diff --git a/recipe_modules/build_util/examples/full.expected/mac.json b/recipe_modules/build_util/examples/full.expected/mac.json
index 0468883..94b63fd 100644
--- a/recipe_modules/build_util/examples/full.expected/mac.json
+++ b/recipe_modules/build_util/examples/full.expected/mac.json
@@ -563,6 +563,155 @@
   },
   {
     "cmd": [],
+    "name": "collect rbe logs"
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/bootstrap.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read bootstrap.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@bootstrap.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/rbe_metrics.txt",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read rbe_metrics.txt",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rbe_metrics.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read reproxy.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy-gomaip.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read reproxy-gomaip.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy_outerr.log",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read reproxy_outerr.log",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_outerr.log@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/rewrapper.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read rewrapper.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rewrapper.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "glob",
+      "[CLEANUP]/rbe",
+      "*.rrpl"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.find rrpl files",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
+      "@@@STEP_LOG_END@glob@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
+    ]
+  },
+  {
+    "cmd": [],
     "name": "install infra/rbe/client"
   },
   {
@@ -723,6 +872,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution.collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -749,9 +905,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read bootstrap.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -782,9 +938,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read rbe_metrics.txt",
+    "name": "teardown remote execution.collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -815,9 +971,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -848,9 +1004,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -881,9 +1037,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy_outerr.log",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -914,9 +1070,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read rewrapper.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -947,9 +1103,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.find rrpl files",
+    "name": "teardown remote execution.collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -981,9 +1137,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
     ]
   },
diff --git a/recipe_modules/rbe/__init__.py b/recipe_modules/rbe/__init__.py
index 21b6f95..fe1a791 100644
--- a/recipe_modules/rbe/__init__.py
+++ b/recipe_modules/rbe/__init__.py
@@ -9,6 +9,7 @@
     "recipe_engine/cipd",
     "recipe_engine/context",
     "recipe_engine/file",
+    "recipe_engine/futures",
     "recipe_engine/json",
     "recipe_engine/path",
     "recipe_engine/platform",
diff --git a/recipe_modules/rbe/api.py b/recipe_modules/rbe/api.py
index 15467a3..8600940 100644
--- a/recipe_modules/rbe/api.py
+++ b/recipe_modules/rbe/api.py
@@ -32,7 +32,34 @@
     if not self._instance and self._test_data.enabled:
       self._instance = "fake_rbe_instance"
     self._log_format = props.log_format or "reducedtext"
-    self._started = False
+    self._started = False  # A flag tracking if rbe service is running.
+    self._rbe_triggered = False  # A flag tracking if rbe service has ever been started.
+
+  def set_rbe_triggered(self, triggered):
+    self._rbe_triggered = triggered
+
+  def wait_and_collect_logs(self, collect_rbe_logs_latency, working_dir):
+    """Collect logs if build running time exceeds collect_rbe_logs_latency.
+
+    collect_rbe_logs_latency(int): the latency (in seconds) to wait before collecting rbe logs.
+    working_dir(path): the working path.
+    """
+    timer_seconds = 0  # tracks how long this has been waiting
+    sleep_period_seconds = 60  # in seconds
+    while True:
+      # If build has been running over the `collect_rbe_logs_latency`,
+      # we will proactivelly collect rbe logs to avoid logs loss when
+      # timeout happens.
+      if timer_seconds > collect_rbe_logs_latency:
+        self._collect_logs(working_dir)
+        break
+      # If rbe service started before and is not running now, it means
+      # rbe has finished building and has been shutdown normally. For
+      # This case, we just exit.
+      if self._rbe_triggered and not self._started:
+        break
+      timer_seconds += sleep_period_seconds
+      self.m.time.sleep(sleep_period_seconds)
 
   @contextmanager
   def __call__(
@@ -40,6 +67,7 @@
       reclient_path=None,
       config_path=None,
       working_path=None,
+      collect_rbe_logs_latency=None,
   ):
     """Make context wrapping reproxy start/stop.
 
@@ -51,6 +79,11 @@
         Raises:
             StepFailure or InfraFailure if it fails to start/stop.
         """
+    # Spawns a backend process to wait and collect rbe build logs in case build timing out.
+    self.m.futures.spawn(
+        self.wait_and_collect_logs, collect_rbe_logs_latency, working_path
+    )
+
     if reclient_path:
       self._reclient_path = reclient_path
     else:
@@ -70,6 +103,7 @@
     with self.m.context(env=self._environment(working_dir), infra_steps=True):
       try:
         self._start(config_path=config_path)
+        self.set_rbe_triggered(True)
         with self.m.context(infra_steps=is_infra_step):
           yield
       finally:
@@ -143,71 +177,75 @@
         self.m.step("stop reproxy", cmd)
         self._started = False
       finally:
-        # reproxy/rewrapper/bootstrap record various log information in
-        # a number of locations. At the time of this implementation,
-        # the following log files are used:
-        # 1. bootstrap.<INFO|WARNING|ERROR|FATAL> is standard logging
-        # for `bootstrap`. Each log file includes more severe logging
-        # levels, e.g. bootstrap.WARNING includes WARNING, ERROR & FATAL
-        # log messages.
-        # 2. rbe_metrics.txt is the text representation of a proto
-        # message that describes metrics related to the rbe execution.
-        # 3. reproxy.<INFO|WARNING|ERROR|FATAL> is standard logging for
-        # `reproxy`. See notes in #1 for more details.
-        # 4. reproxy_log.txt is the log file that records all info
-        # about all actions that are processed through reproxy.
-        # 5. reproxy_outerr.log is merged stderr/stdout of `reproxy`.
-        # 6. rewrapper.<INFO|WARNING|ERROR|FATAL> is standard logging
-        # for `rewrapper`. See notes in #1 for more details.
-        # 7. reproxy-gomaip.<INFO|WARNING|ERROR|FATAL> is logging
-        # for `gomaip` which is the input processor used by `reclient`
-        # for finding dependencies of `clang` compile invocations.
-        #
-        # We extract the WARNING log messages for each portion of the
-        # local rbe client as well as reproxy stdout/stderr and metrics
-        # from the build by default. If further debugging is required,
-        # you could increase the verbosity of log messages that we
-        # retain in logdog or add the full reproxy_log.txt log file to
-        # the list of outputs.
-        diagnostic_outputs = [
-            "bootstrap.WARNING",
-            "rbe_metrics.txt",
-            "reproxy.WARNING",
-            "reproxy-gomaip.WARNING",
-            "reproxy_outerr.log",
-            "rewrapper.WARNING",
-        ]
+        self._collect_logs(working_dir)
 
-        for output in diagnostic_outputs:
-          path = working_dir.join(output)
-          # Not all builds use rbe, so it might not exist.
-          self.m.path.mock_add_paths(path)
-          if self.m.path.exists(path):
-            # Read the log so it shows up in Milo for debugging.
-            self.m.file.read_text(f"read {output}", path)
+  def _collect_logs(self, working_dir):
+    # reproxy/rewrapper/bootstrap record various log information in
+    # a number of locations. At the time of this implementation,
+    # the following log files are used:
+    # 1. bootstrap.<INFO|WARNING|ERROR|FATAL> is standard logging
+    # for `bootstrap`. Each log file includes more severe logging
+    # levels, e.g. bootstrap.WARNING includes WARNING, ERROR & FATAL
+    # log messages.
+    # 2. rbe_metrics.txt is the text representation of a proto
+    # message that describes metrics related to the rbe execution.
+    # 3. reproxy.<INFO|WARNING|ERROR|FATAL> is standard logging for
+    # `reproxy`. See notes in #1 for more details.
+    # 4. reproxy_log.txt is the log file that records all info
+    # about all actions that are processed through reproxy.
+    # 5. reproxy_outerr.log is merged stderr/stdout of `reproxy`.
+    # 6. rewrapper.<INFO|WARNING|ERROR|FATAL> is standard logging
+    # for `rewrapper`. See notes in #1 for more details.
+    # 7. reproxy-gomaip.<INFO|WARNING|ERROR|FATAL> is logging
+    # for `gomaip` which is the input processor used by `reclient`
+    # for finding dependencies of `clang` compile invocations.
+    #
+    # We extract the WARNING log messages for each portion of the
+    # local rbe client as well as reproxy stdout/stderr and metrics
+    # from the build by default. If further debugging is required,
+    # you could increase the verbosity of log messages that we
+    # retain in logdog or add the full reproxy_log.txt log file to
+    # the list of outputs.
+    with self.m.step.nest("collect rbe logs"):
+      diagnostic_outputs = [
+          "bootstrap.WARNING",
+          "rbe_metrics.txt",
+          "reproxy.WARNING",
+          "reproxy-gomaip.WARNING",
+          "reproxy_outerr.log",
+          "rewrapper.WARNING",
+      ]
 
-        # reproxy also produces a log file of all the actions which
-        # it handles including more detailed debugging information
-        # useful for debugging.
-        rpl_ext = {
-            "text": "rpl",
-            "reducedtext": "rrpl",
-        }[self._log_format]
-        rpl_file_glob = f"*.{rpl_ext}"
-        rpl_paths = self.m.file.glob_paths(
-            name=f"find {rpl_ext} files",
-            source=working_dir,
-            pattern=rpl_file_glob,
-            test_data=[
-                f"reproxy_2021-10-16_22_52_23.{rpl_ext}",
-            ],
-        )
+      for output in diagnostic_outputs:
+        path = working_dir.join(output)
+        # Not all builds use rbe, so it might not exist.
+        self.m.path.mock_add_paths(path)
+        if self.m.path.exists(path):
+          # Read the log so it shows up in Milo for debugging.
+          self.m.file.read_text(f"read {output}", path)
 
-        # More than 1 rpl file is likely a bug but we can punt until
-        # that breaks someone.
-        for p in rpl_paths:
-          self.m.path.mock_add_paths(p)
-          # Not all builds use rbe, so it might not exist.
-          if self.m.path.exists(p):
-            # Read the log so it shows up in Milo for debugging.
-            self.m.file.read_text(f"read {self.m.path.basename(p)}", p)
+      # reproxy also produces a log file of all the actions which
+      # it handles including more detailed debugging information
+      # useful for debugging.
+      rpl_ext = {
+          "text": "rpl",
+          "reducedtext": "rrpl",
+      }[self._log_format]
+      rpl_file_glob = f"*.{rpl_ext}"
+      rpl_paths = self.m.file.glob_paths(
+          name=f"find {rpl_ext} files",
+          source=working_dir,
+          pattern=rpl_file_glob,
+          test_data=[
+              f"reproxy_2021-10-16_22_52_23.{rpl_ext}",
+          ],
+      )
+
+      # More than 1 rpl file is likely a bug but we can punt until
+      # that breaks someone.
+      for p in rpl_paths:
+        self.m.path.mock_add_paths(p)
+        # Not all builds use rbe, so it might not exist.
+        if self.m.path.exists(p):
+          # Read the log so it shows up in Milo for debugging.
+          self.m.file.read_text(f"read {self.m.path.basename(p)}", p)
diff --git a/recipe_modules/rbe/tests/full.expected/basic.json b/recipe_modules/rbe/tests/full.expected/basic.json
index bea5a5a..961f15f 100644
--- a/recipe_modules/rbe/tests/full.expected/basic.json
+++ b/recipe_modules/rbe/tests/full.expected/basic.json
@@ -145,6 +145,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution.collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -183,9 +190,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read bootstrap.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -228,9 +235,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rbe_metrics.txt",
+    "name": "teardown remote execution.collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -273,9 +280,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -318,9 +325,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -363,9 +370,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_outerr.log",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -408,9 +415,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rewrapper.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -453,9 +460,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.find rrpl files",
+    "name": "teardown remote execution.collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -499,9 +506,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
     ]
   },
@@ -729,6 +736,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution (2).collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -767,9 +781,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read bootstrap.WARNING",
+    "name": "teardown remote execution (2).collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -812,9 +826,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read rbe_metrics.txt",
+    "name": "teardown remote execution (2).collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -857,9 +871,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read reproxy.WARNING",
+    "name": "teardown remote execution (2).collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -902,9 +916,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution (2).collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -947,9 +961,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read reproxy_outerr.log",
+    "name": "teardown remote execution (2).collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -992,9 +1006,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read rewrapper.WARNING",
+    "name": "teardown remote execution (2).collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -1037,9 +1051,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).find rrpl files",
+    "name": "teardown remote execution (2).collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -1083,7 +1097,497 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution (2).collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@",
+      "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "collect rbe logs"
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/bootstrap.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read bootstrap.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@bootstrap.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/rbe_metrics.txt",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rbe_metrics.txt",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rbe_metrics.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy-gomaip.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy-gomaip.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy_outerr.log",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_outerr.log",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_outerr.log@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/rewrapper.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rewrapper.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rewrapper.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "glob",
+      "[CLEANUP]/rbe",
+      "*.rrpl"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.find rrpl files",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
+      "@@@STEP_LOG_END@glob@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "collect rbe logs (2)"
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/bootstrap.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read bootstrap.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@bootstrap.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/rbe_metrics.txt",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read rbe_metrics.txt",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rbe_metrics.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read reproxy.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy-gomaip.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read reproxy-gomaip.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy_outerr.log",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read reproxy_outerr.log",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_outerr.log@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/rewrapper.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read rewrapper.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rewrapper.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "glob",
+      "[CLEANUP]/rbe",
+      "*.rrpl"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).find rrpl files",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
+      "@@@STEP_LOG_END@glob@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
diff --git a/recipe_modules/rbe/tests/full.expected/read_log_proto_failure_does_not_block.json b/recipe_modules/rbe/tests/full.expected/read_log_proto_failure_does_not_block.json
index bea5a5a..961f15f 100644
--- a/recipe_modules/rbe/tests/full.expected/read_log_proto_failure_does_not_block.json
+++ b/recipe_modules/rbe/tests/full.expected/read_log_proto_failure_does_not_block.json
@@ -145,6 +145,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution.collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -183,9 +190,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read bootstrap.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -228,9 +235,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rbe_metrics.txt",
+    "name": "teardown remote execution.collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -273,9 +280,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -318,9 +325,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -363,9 +370,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_outerr.log",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -408,9 +415,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rewrapper.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -453,9 +460,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.find rrpl files",
+    "name": "teardown remote execution.collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -499,9 +506,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
     ]
   },
@@ -729,6 +736,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution (2).collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -767,9 +781,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read bootstrap.WARNING",
+    "name": "teardown remote execution (2).collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -812,9 +826,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read rbe_metrics.txt",
+    "name": "teardown remote execution (2).collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -857,9 +871,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read reproxy.WARNING",
+    "name": "teardown remote execution (2).collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -902,9 +916,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution (2).collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -947,9 +961,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read reproxy_outerr.log",
+    "name": "teardown remote execution (2).collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -992,9 +1006,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read rewrapper.WARNING",
+    "name": "teardown remote execution (2).collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -1037,9 +1051,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).find rrpl files",
+    "name": "teardown remote execution (2).collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -1083,7 +1097,497 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution (2).read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution (2).collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@2@@@",
+      "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "collect rbe logs"
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/bootstrap.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read bootstrap.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@bootstrap.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/rbe_metrics.txt",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rbe_metrics.txt",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rbe_metrics.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy-gomaip.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy-gomaip.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy_outerr.log",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_outerr.log",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_outerr.log@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/rewrapper.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rewrapper.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rewrapper.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "glob",
+      "[CLEANUP]/rbe",
+      "*.rrpl"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.find rrpl files",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
+      "@@@STEP_LOG_END@glob@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
+    ]
+  },
+  {
+    "cmd": [],
+    "name": "collect rbe logs (2)"
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/bootstrap.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read bootstrap.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@bootstrap.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/rbe_metrics.txt",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read rbe_metrics.txt",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rbe_metrics.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read reproxy.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy-gomaip.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read reproxy-gomaip.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy_outerr.log",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read reproxy_outerr.log",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_outerr.log@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/rewrapper.WARNING",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read rewrapper.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rewrapper.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "glob",
+      "[CLEANUP]/rbe",
+      "*.rrpl"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).find rrpl files",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
+      "@@@STEP_LOG_END@glob@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:try"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs (2).read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
       "@@@STEP_NEST_LEVEL@1@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
diff --git a/recipe_modules/rbe/tests/full.expected/start_rbe_failed.json b/recipe_modules/rbe/tests/full.expected/start_rbe_failed.json
index 7496890..5e1d6d6 100644
--- a/recipe_modules/rbe/tests/full.expected/start_rbe_failed.json
+++ b/recipe_modules/rbe/tests/full.expected/start_rbe_failed.json
@@ -79,6 +79,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution.collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -105,9 +112,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read bootstrap.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -138,9 +145,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read rbe_metrics.txt",
+    "name": "teardown remote execution.collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -171,9 +178,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -204,9 +211,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -237,9 +244,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy_outerr.log",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -270,9 +277,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read rewrapper.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -303,9 +310,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.find rrpl files",
+    "name": "teardown remote execution.collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -337,9 +344,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
     ]
   },
diff --git a/recipe_modules/rbe/tests/full.expected/stop_rbe_failed.json b/recipe_modules/rbe/tests/full.expected/stop_rbe_failed.json
index e599d7e..5720881 100644
--- a/recipe_modules/rbe/tests/full.expected/stop_rbe_failed.json
+++ b/recipe_modules/rbe/tests/full.expected/stop_rbe_failed.json
@@ -101,6 +101,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution.collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -127,9 +134,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read bootstrap.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -160,9 +167,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read rbe_metrics.txt",
+    "name": "teardown remote execution.collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -193,9 +200,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -226,9 +233,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -259,9 +266,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy_outerr.log",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -292,9 +299,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read rewrapper.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -325,9 +332,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.find rrpl files",
+    "name": "teardown remote execution.collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -359,9 +366,9 @@
       "RBE_use_gce_credentials": "true"
     },
     "infra_step": true,
-    "name": "teardown remote execution.read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
     ]
   },
diff --git a/recipe_modules/rbe/tests/full.py b/recipe_modules/rbe/tests/full.py
index fcece09..00103fe 100644
--- a/recipe_modules/rbe/tests/full.py
+++ b/recipe_modules/rbe/tests/full.py
@@ -24,6 +24,17 @@
                working_path=api.path["cleanup"].join("rbe")):
     # build something using rbe.
     api.step("build", ["echo", "Misison Accomplished!"])
+  api.rbe.wait_and_collect_logs(
+      working_dir=api.path["cleanup"].join("rbe"), collect_rbe_logs_latency=-1
+  )
+  api.rbe.set_rbe_triggered(False)
+  api.rbe.wait_and_collect_logs(
+      working_dir=api.path["cleanup"].join("rbe"), collect_rbe_logs_latency=61
+  )
+  api.rbe.set_rbe_triggered(True)
+  api.rbe.wait_and_collect_logs(
+      working_dir=api.path["cleanup"].join("rbe"), collect_rbe_logs_latency=61
+  )
 
 
 def GenTests(api):
diff --git a/recipes/engine_v2/builder.expected/basic.json b/recipes/engine_v2/builder.expected/basic.json
index 9d9f6c1..e224f57 100644
--- a/recipes/engine_v2/builder.expected/basic.json
+++ b/recipes/engine_v2/builder.expected/basic.json
@@ -1397,6 +1397,451 @@
   },
   {
     "cmd": [],
+    "name": "collect rbe logs"
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/bootstrap.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read bootstrap.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@bootstrap.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/rbe_metrics.txt",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rbe_metrics.txt",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rbe_metrics.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy-gomaip.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy-gomaip.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy_outerr.log",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_outerr.log",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_outerr.log@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/rewrapper.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rewrapper.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rewrapper.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "glob",
+      "[CLEANUP]/rbe_tmp_1",
+      "*.rrpl"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.find rrpl files",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl@@@",
+      "@@@STEP_LOG_END@glob@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
+    ]
+  },
+  {
+    "cmd": [],
     "name": "install infra/rbe/client"
   },
   {
@@ -1772,6 +2217,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution.collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -1833,9 +2285,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read bootstrap.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -1901,9 +2353,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rbe_metrics.txt",
+    "name": "teardown remote execution.collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -1969,9 +2421,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -2037,9 +2489,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -2105,9 +2557,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_outerr.log",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -2173,9 +2625,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rewrapper.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -2241,9 +2693,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.find rrpl files",
+    "name": "teardown remote execution.collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -2310,9 +2762,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
     ]
   },
diff --git a/recipes/engine_v2/builder.expected/dart-internal-flutter-success.json b/recipes/engine_v2/builder.expected/dart-internal-flutter-success.json
index 3de3ad1..34ec103 100644
--- a/recipes/engine_v2/builder.expected/dart-internal-flutter-success.json
+++ b/recipes/engine_v2/builder.expected/dart-internal-flutter-success.json
@@ -538,6 +538,451 @@
   },
   {
     "cmd": [],
+    "name": "collect rbe logs"
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/bootstrap.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart-internal:flutter"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read bootstrap.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@bootstrap.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/rbe_metrics.txt",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart-internal:flutter"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rbe_metrics.txt",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rbe_metrics.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart-internal:flutter"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy-gomaip.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart-internal:flutter"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy-gomaip.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy_outerr.log",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart-internal:flutter"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_outerr.log",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_outerr.log@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/rewrapper.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart-internal:flutter"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rewrapper.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rewrapper.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "glob",
+      "[CLEANUP]/rbe_tmp_1",
+      "*.rrpl"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart-internal:flutter"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.find rrpl files",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl@@@",
+      "@@@STEP_LOG_END@glob@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "2d72510e447ab60a9728aeea2362d8be2cbd7789"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart-internal:flutter"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
+    ]
+  },
+  {
+    "cmd": [],
     "name": "install infra/rbe/client"
   },
   {
@@ -913,6 +1358,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution.collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -974,9 +1426,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read bootstrap.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -1042,9 +1494,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rbe_metrics.txt",
+    "name": "teardown remote execution.collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -1110,9 +1562,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -1178,9 +1630,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -1246,9 +1698,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_outerr.log",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -1314,9 +1766,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rewrapper.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -1382,9 +1834,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.find rrpl files",
+    "name": "teardown remote execution.collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -1451,9 +1903,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
     ]
   },
diff --git a/recipes/engine_v2/builder.expected/mac.json b/recipes/engine_v2/builder.expected/mac.json
index 9256b99..3ca135a 100644
--- a/recipes/engine_v2/builder.expected/mac.json
+++ b/recipes/engine_v2/builder.expected/mac.json
@@ -1940,6 +1940,451 @@
   },
   {
     "cmd": [],
+    "name": "collect rbe logs"
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/bootstrap.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "darwin",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read bootstrap.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@bootstrap.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/rbe_metrics.txt",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "darwin",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rbe_metrics.txt",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rbe_metrics.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "darwin",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy-gomaip.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "darwin",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy-gomaip.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy_outerr.log",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "darwin",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_outerr.log",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_outerr.log@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/rewrapper.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "darwin",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rewrapper.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rewrapper.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "glob",
+      "[CLEANUP]/rbe_tmp_1",
+      "*.rrpl"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "darwin",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.find rrpl files",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl@@@",
+      "@@@STEP_LOG_END@glob@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "CLANG_CRASH_DIAGNOSTICS_DIR": "[CLEANUP]/tmp_tmp_3",
+      "CLANG_MODULE_CACHE_PATH": "",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder",
+      "ENGINE_PATH": "[CACHE]/builder",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_CLEANUP": "[CLEANUP]",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "darwin",
+      "REVISION": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "flutter:prod"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
+    ]
+  },
+  {
+    "cmd": [],
     "name": "install infra/rbe/client"
   },
   {
@@ -2315,6 +2760,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution.collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -2376,9 +2828,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read bootstrap.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -2444,9 +2896,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rbe_metrics.txt",
+    "name": "teardown remote execution.collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -2512,9 +2964,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -2580,9 +3032,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -2648,9 +3100,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_outerr.log",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -2716,9 +3168,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rewrapper.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -2784,9 +3236,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.find rrpl files",
+    "name": "teardown remote execution.collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -2853,9 +3305,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
     ]
   },
diff --git a/recipes/engine_v2/builder.expected/monorepo.json b/recipes/engine_v2/builder.expected/monorepo.json
index fe3fc3f..a8725de 100644
--- a/recipes/engine_v2/builder.expected/monorepo.json
+++ b/recipes/engine_v2/builder.expected/monorepo.json
@@ -1338,6 +1338,427 @@
   },
   {
     "cmd": [],
+    "name": "collect rbe logs"
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/bootstrap.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read bootstrap.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@bootstrap.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/rbe_metrics.txt",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rbe_metrics.txt",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rbe_metrics.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy-gomaip.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy-gomaip.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy_outerr.log",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_outerr.log",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_outerr.log@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/rewrapper.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rewrapper.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rewrapper.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "glob",
+      "[CLEANUP]/rbe_tmp_1",
+      "*.rrpl"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.find rrpl files",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl@@@",
+      "@@@STEP_LOG_END@glob@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
+    ]
+  },
+  {
+    "cmd": [],
     "name": "install infra/rbe/client"
   },
   {
@@ -1695,6 +2116,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution.collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -1753,9 +2181,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read bootstrap.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -1818,9 +2246,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rbe_metrics.txt",
+    "name": "teardown remote execution.collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -1883,9 +2311,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -1948,9 +2376,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -2013,9 +2441,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_outerr.log",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -2078,9 +2506,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rewrapper.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -2143,9 +2571,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.find rrpl files",
+    "name": "teardown remote execution.collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -2209,9 +2637,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
     ]
   },
diff --git a/recipes/engine_v2/builder.expected/monorepo_tryjob.json b/recipes/engine_v2/builder.expected/monorepo_tryjob.json
index 1f475d9..a5adc35 100644
--- a/recipes/engine_v2/builder.expected/monorepo_tryjob.json
+++ b/recipes/engine_v2/builder.expected/monorepo_tryjob.json
@@ -1425,6 +1425,427 @@
   },
   {
     "cmd": [],
+    "name": "collect rbe logs"
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/bootstrap.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": ""
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read bootstrap.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@bootstrap.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/rbe_metrics.txt",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": ""
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rbe_metrics.txt",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rbe_metrics.txt@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": ""
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy-gomaip.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": ""
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy-gomaip.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy_outerr.log",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": ""
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_outerr.log",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_outerr.log@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/rewrapper.WARNING",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": ""
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read rewrapper.WARNING",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@rewrapper.WARNING@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "glob",
+      "[CLEANUP]/rbe_tmp_1",
+      "*.rrpl"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": ""
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.find rrpl files",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl@@@",
+      "@@@STEP_LOG_END@glob@@@"
+    ]
+  },
+  {
+    "cmd": [
+      "vpython3",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl",
+      "/path/to/tmp/"
+    ],
+    "env": {
+      "ANDROID_HOME": "[CACHE]/builder/engine/src/third_party/android_tools/sdk",
+      "ANDROID_SDK_HOME": "[CLEANUP]/tmp_tmp_2",
+      "ANDROID_USER_HOME": "[CLEANUP]/tmp_tmp_2/.android",
+      "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "ENGINE_CHECKOUT_PATH": "[CACHE]/builder/engine",
+      "ENGINE_PATH": "[CACHE]/builder/engine",
+      "FLUTTER_LOGS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "FLUTTER_TEST_OUTPUTS_DIR": "[CLEANUP]/flutter_logs_dir",
+      "GIT_BRANCH": "",
+      "LUCI_BRANCH": "",
+      "LUCI_CI": "True",
+      "LUCI_PR": "",
+      "LUCI_WORKDIR": "[START_DIR]",
+      "OS": "linux",
+      "REVISION": ""
+    },
+    "env_prefixes": {
+      "PATH": [
+        "[CACHE]/builder/engine/src/third_party/dart/tools/sdks/dart-sdk/bin"
+      ]
+    },
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "dart:ci.sandbox"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
+    ]
+  },
+  {
+    "cmd": [],
     "name": "install infra/rbe/client"
   },
   {
@@ -1782,6 +2203,13 @@
     ]
   },
   {
+    "cmd": [],
+    "name": "teardown remote execution.collect rbe logs",
+    "~followup_annotations": [
+      "@@@STEP_NEST_LEVEL@1@@@"
+    ]
+  },
+  {
     "cmd": [
       "vpython3",
       "-u",
@@ -1840,9 +2268,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read bootstrap.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read bootstrap.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@bootstrap.WARNING@@@"
     ]
   },
@@ -1905,9 +2333,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rbe_metrics.txt",
+    "name": "teardown remote execution.collect rbe logs.read rbe_metrics.txt",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rbe_metrics.txt@@@"
     ]
   },
@@ -1970,9 +2398,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy.WARNING@@@"
     ]
   },
@@ -2035,9 +2463,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy-gomaip.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read reproxy-gomaip.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy-gomaip.WARNING@@@"
     ]
   },
@@ -2100,9 +2528,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_outerr.log",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_outerr.log",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_outerr.log@@@"
     ]
   },
@@ -2165,9 +2593,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read rewrapper.WARNING",
+    "name": "teardown remote execution.collect rbe logs.read rewrapper.WARNING",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@rewrapper.WARNING@@@"
     ]
   },
@@ -2230,9 +2658,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.find rrpl files",
+    "name": "teardown remote execution.collect rbe logs.find rrpl files",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_LINE@glob@[CLEANUP]/rbe_tmp_1/reproxy_2021-10-16_22_52_23.rrpl@@@",
       "@@@STEP_LOG_END@glob@@@"
     ]
@@ -2296,9 +2724,9 @@
         "hostname": "rdbhost"
       }
     },
-    "name": "teardown remote execution.read reproxy_2021-10-16_22_52_23.rrpl",
+    "name": "teardown remote execution.collect rbe logs.read reproxy_2021-10-16_22_52_23.rrpl",
     "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
+      "@@@STEP_NEST_LEVEL@2@@@",
       "@@@STEP_LOG_END@reproxy_2021-10-16_22_52_23.rrpl@@@"
     ]
   },