Print warnings of scalyr-agent-2-config to stderr
schra opened this issue · 3 comments
What
Following the instructions from https://app.scalyr.com/help/scalyr-agent-k8s#export-config fails
root@scalyr-84g88:/# scalyr-agent-2-config --export-config - | tar -xz
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Why
Warnings are printed to stdout instead of stderr and thus are also piped to tar
:
root@scalyr-84g88:/# scalyr-agent-2-config --export-config -
2021-01-19 15:52:36.895Z WARNING [monitor:__main__] [configuration.py:327] Configured option min_request_spacing_interval is being overridden due to max_send_rate_enforcement setting.
D`�o0���K��JJk��6A߽�T}
�OH�f�\�jF�ߑʪ ͫty͂$͓lF�gv8�d3�p�\+�g�3*%Uhn$N�ޠG+a�^�7�O�Y%⺏gxy߰9�
.az�v��˸���r��g���Fsa���5�_:y{q��ƫ�~NIUR�yEQ�[U�_+i����濦62Z���%��F��>�y�?~ϊ�� 5ǹ(root@scalyr-84g88:/# `��
Manually removing the warning is a workaround that works:
root@scalyr-84g88:/# scalyr-agent-2-config --export-config - | tail -n +2 | tar -xz
root@scalyr-84g88:/#
Docker image version: 2.1.15
Definition of done
The logger should print warnings and errors to stderr
and not strdout
. I think this should probably be done here:
scalyr-agent-2/scalyr_agent/scalyr_logging.py
Lines 75 to 91 in 539b012
Thanks for submitting this. This has been submitted to engineering, and we will let you know when there are any updates on it. Thanks again for such a thorough analysis, troubleshooting, and repro steps.
Digging into this deeper, can you give me an idea of what you are trying to modify? Or did you just stumble upon this bug? Though this is a way to modify the agent config, it is sort of old. It is still useful, but there are easier ways to make changes.
Digging into this deeper, can you give me an idea of what you are trying to modify? Or did you just stumble upon this bug? Though this is a way to modify the agent config, it is sort of old.
I followed the documentation (https://app.scalyr.com/help/scalyr-agent-k8s#export-config) which told me to execute scalyr-agent-2-config --export-config - | tar -xz
and so I executed it and it didn't work due to the warning being printed to stdout.
It is still useful, but there are easier ways to make changes.
Maybe updating this paragraph here https://app.scalyr.com/help/scalyr-agent-k8s#export-config and deprecating --export-config
would be helpful if there are easier ways to make changes.