How to save stdout from buildkite-agent to file

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.

Most these commands print to STDERR, not STDOUT.

https://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html

Hi @novak100!

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

Cheers!

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

1 Like