<p>I have a few packer templates which have several builders - up to 5 per template. This makes it very easy to provision all the resources necessary in a pipeline -- however by default packer writes all the output in a single stream. Yes, it separates builders by colour which makes it a bit easier to see what's going on, but it is nevertheless very difficult to find where a particular build failed.</p>

<p>I would like to know what would be a good way to split the packer output per builder into a separate file.</p>

<p>Note :</p>

<ul>
<li>I <strong>do not</strong> want to lose paralellism</li>
<li>I <strong>do</strong> accept that some post-processing of the log is necessary</li>
</ul>

<p>Packer has a <code>-machine-readable</code> flag which writes things like :</p>

<pre><code>1564995900,,ui,message,    admin-ami: Instance ID: i-04ef2474a070403ad
1564995900,,ui,say,==&gt; admin-ami: Waiting for instance (i-04ef2474a070403ad) to become ready...
</code></pre>

<p>which one could parse.</p>

CC BY-SA 4.0
2019-12-20T09:44:08.787Z
Could you check whether there is a related  issue on https://github.com/hashicorp/packer?
030
CC BY-SA 4.0
2022-06-26T11:36:59.410Z
I agree this would be a useful feature in Packer.  Surprised it's not implemented right now.  I know how to split the output afterwards using grep on the colour headers, but no simple way to do this without a feature request.  It seems an easy feature to code.  I'll take a look.
BoeroBoy
<packer><logging>
How to write output per builder into separate log files in Packer?
Bruce Becker
# How to write output per builder into separate log files in Packer?

(Asked by: username_0 on 2019-08-05)

I have a few packer templates which have several builders - up to 5 per template. This makes it very easy to provision all the resources necessary in a pipeline -- however by default packer writes all the output in a single stream. Yes, it separates builders by colour which makes it a bit easier to see what's going on, but it is nevertheless very difficult to find where a particular build failed.
I would like to know what would be a good way to split the packer output per builder into a separate file.
Note :

I do not want to lose paralellism
I do accept that some post-processing of the log is necessary

Packer has a -machine-readable flag which writes things like :
1564995900,,ui,message,    admin-ami: Instance ID: i-04ef2474a070403ad
1564995900,,ui,say,==> admin-ami: Waiting for instance (i-04ef2474a070403ad) to become ready...

which one could parse.

**Tags:** packer, logging

> **Comments:**
> **username_1**: Could you check whether there is a related  issue on https://github.com/hashicorp/packer?  
> **username_2**: I agree this would be a useful feature in Packer.  Surprised it's not implemented right now.  I know how to split the output afterwards using grep on the colour headers, but no simple way to do this without a feature request.  It seems an easy feature to code.  I'll take a look.  

---

## 0 answers

