# Nested Log Sections

**URL:** <https://forum.buildkite.community/t/nested-log-sections/4212>\
**Category:** Features Requests\
**Created:** [February 5, 2025, 7:54pm UTC](https://forum.buildkite.community/t/nested-log-sections/4212 "2025-02-05T19:54:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![noahtallen](https://avatars.discourse-cdn.com/v4/letter/n/51bf81/32.png) [@noahtallen](https://forum.buildkite.community/u/noahtallen)\
**Post date:** [February 5, 2025, 7:54pm UTC](https://forum.buildkite.community/t/nested-log-sections/4212/1 "2025-02-05T19:54:00Z")

</div>

Hello, I’d like to request the ability to nest “[log groups](https://buildkite.com/docs/pipelines/configure/managing-log-output)”. In my case, it’d be useful to have very granular sections, maybe even one for each test, and only expand the test output which fails. This way, more information could be included in each test’s logs (for example, a collapsed group with extra logs) without making it harder to look through the logs at glance.

The syntax could look like `--- ---`, or something along those lines. For example:

```sh
--- Starting tests < normal log section
Log some stuff
--- --- Test 1 < nested log section
a lot more logs
error detected!
^^^ ^^^ +++ < expand current subsection, which expands parents. 
--- --- Test 2
logs for test 2
--- --- --- Nested closed section
some info that could stay closed
+++ +++ +++ A nested nested section.
Stuff here -- the nested expansion expands parents without expanding siblings.
--- --- Test 3
More stuff
--- Tests over, do something else

```

This would be a super useful (and powerful) way to make logs easier to work with in BuildKite.

---

<div class="post-metadata">

**Author:** ![justin.downer](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@justin.downer](https://forum.buildkite.community/u/justin.downer)\
**Post date:** [February 5, 2025, 9:33pm UTC](https://forum.buildkite.community/t/nested-log-sections/4212/2 "2025-02-05T21:33:19Z")

</div>

Hi @noahtallen, thank you for the feedback. You are correct, as of today, Buildkite’s built-in log grouping features do not support true nested collapsible sections. While you can create multiple “groups” in a log by using the —, +++, and ^^^ markers, Buildkite only displays them at a single level. In other words, each “section” can be collapsed or expanded, but you cannot have sub-sections (and sub-sub-sections, etc.) which automatically expand their parents.

With that said see below are some potential workarounds.

**What is currently supported** :

Buildkite supports “collapsible” log output using certain markers in the stdout of each job:

• — Some Title

Creates a collapsible section **collapsed by default**.

• +++ Some Title

Creates a collapsible section **expanded by default**.

• ^^^ Some Title

Ends the previous section. (If you’re seeing older references, there’s a bit of variation in how these markers get used, but typically ^^^ is the “close” marker.)

This only provides one top-level layer. For example:

echo “— Starting tests”

echo “Line 1 of logs”

echo “Line 2 of logs”

echo “^^^ End tests”

Even if you emit more markers inside of that section, Buildkite won’t treat them as nested sections. They all end up as siblings in the top-level grouping.

**Possible workarounds** :

1. **Multiple pipeline steps**

If your ultimate goal is to separate out logs for each test or test group, you could dynamically generate multiple pipeline steps—one per test or suite. That way, each step’s logs can be treated as an isolated “block” in the Buildkite UI. It’s not truly “nested,” but it does separate log data.

1. **Artifacts for additional logs**

If you have extensive logs per test, consider capturing them as artifacts. Your main logs can display only essential, high-level details, and then if a test fails, you can navigate to the uploaded artifact for deeper logs. That keeps the main build logs from getting unwieldy.

1. **Use test analytics (Buildkite Test Analytics)**

If your real desire is to see a pass/fail summary with detailed logs only on failures, you might benefit from Buildkite’s[Test Analytics](https://buildkite.com/docs/test-analytics) feature. It’s not the same as nested logs, but it’s designed to help you quickly see which tests failed, with a direct link to the relevant output.

1. **Inline grouping patterns**

Some teams manually implement a pseudo-nesting approach with headings or indentation in the logs (e.g., ##, ### lines). It does not give you collapsible sections, but it can provide a visual structure for scanning logs.

Below are the key links:

1. **Buildkite: Managing Log Output**

> **[Managing log output](https://buildkite.com/docs/pipelines/configure/managing-log-output)**
>
> Buildkite uses our open-source terminal-to-html tool to provide you with the best possible terminal rendering experience for your build logs, including ANSI terminal emulation to ensure spinners, progress bars, colors and emojis are rendered...

Covers the official docs on how to collapse logs using —, +++, and ^^^.

1. **Buildkite Test Analytics**

> **[Buildkite Test Engine](https://buildkite.com/docs/test-engine)**
>
> Scale out your testing across any framework with Buildkite Test Engine. Speed up builds with real-time flaky test management and intelligent test splitting. Drive accountability and get more out of your existing CI compute with performance insights...

Outlines how to integrate Buildkite’s Test Analytics for better test reporting, including per-test visibility.

Cheers!
