# How to save stdout from buildkite-agent to file

**URL:** https://forum.buildkite.community/t/how-to-save-stdout-from-buildkite-agent-to-file/1783
**Category:** General
**Created:** [November 10, 2021, 11:53am UTC](https://forum.buildkite.community/t/how-to-save-stdout-from-buildkite-agent-to-file/1783 "2021-11-10T11:53:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![novak100](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@novak100](https://forum.buildkite.community/u/novak100)
#### Post date: [November 10, 2021, 11:53am UTC](https://forum.buildkite.community/t/how-to-save-stdout-from-buildkite-agent-to-file/1783/1 "2021-11-10T11:53:38Z")

</div>

Is it possible to grab output of the “buildkite-agent artifact upload” process to a file?  
Smth like this:  
buildkite-agent artifact upload test.json | tee -i logs.txt

I tried that but it always generate empty file, while in job terminal I can see logs like:  
Found 1 files that match “test.json”  
Uploading to default Buildkite artifact storage  
Creating (0-1)/1 artifacts  
Uploading artifact 825386b4-e60a-4c8f-a081-9bd201e05e67 test.json (18 bytes)

I need a way of capturing these logs from pipeline.yaml steps level, either executing as a command or as a bash script.

---

<div class="post-metadata">

### Author: ![moensch](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/moensch/32/33_2.png) [@moensch](https://forum.buildkite.community/u/moensch)
#### Post date: [November 10, 2021, 11:24pm UTC](https://forum.buildkite.community/t/how-to-save-stdout-from-buildkite-agent-to-file/1783/2 "2021-11-10T23:24:50Z")

</div>

Most these commands print to STDERR, not STDOUT.

[https://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html](https://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html)

---

<div class="post-metadata">

### Author: ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)
#### Post date: [November 10, 2021, 11:36pm UTC](https://forum.buildkite.community/t/how-to-save-stdout-from-buildkite-agent-to-file/1783/3 "2021-11-10T23:36:37Z")

</div>

Hi @novak100!

Welcome to the community! 😊  
The log is written in STDERR, not in STDOUT, so that’s why it is probably not capturing your logs.

Cheers!

---

<div class="post-metadata">

### Author: ![novak100](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@novak100](https://forum.buildkite.community/u/novak100)
#### Post date: [November 11, 2021, 3:33pm UTC](https://forum.buildkite.community/t/how-to-save-stdout-from-buildkite-agent-to-file/1783/4 "2021-11-11T15:33:55Z")

</div>

that was it guys! It’s working now.  
Thanks for your help! 👌
