Nginx-rtmp-module: exec_push stdout, stderr shell style redirects not working

Created on 28 Nov 2018  路  3Comments  路  Source: arut/nginx-rtmp-module

I have tried extracting exec_push ffmpeg stdout and stderr for logging purposes, and it does not seem like the output redirects are working.

Here is a simplified command that I am using:

application src {
   live on;
   exec_push /usr/local/bin/ffmpeg -re -i /vod/test.mp4 -c:v copy flv rtmp://localhost/hls/test >>/var/log/ffmpeg_test.out 2>>/var/log/ffmpeg_err.out;
}

None of the log files get generated. I tried an even simpler exec_push command like so:

application src {
   live on;
   exec_push echo test >>/var/log/ffmpeg_test.out 2>>/var/log/ffmpeg_err.out;
}

Which also seems to fail to generate log files. All other mentions of stdout and stderr in the issues seem to be from 4-6 years ago.

Most helpful comment

I've had the same problem when I've started exec_push in Ubuntu docker container - there no files has been created logs in current or any other directories.
BUT logs have been successful created in /tmp dir. I don't know why, but it really works for me!

All 3 comments

I've had the same problem when I've started exec_push in Ubuntu docker container - there no files has been created logs in current or any other directories.
BUT logs have been successful created in /tmp dir. I don't know why, but it really works for me!

@monstarnn thank you, this helped me. I recall there was something about testing ffmpeg commands under nobody user.
Maybe just the log folder should be accessible by nobody user

Update:
I was able to save logs to any folder, by giving permissions to nobody user to my logs folder

To test nobody can't write files to logs folder: sudo -u nobody touch logs/log1.txt

touch: cannot touch 'logs/log1.txt': Permission denied

To give write permission to folder with logs setfacl -m u:nobody:rwx logs/ (does not work with rw, needs rwx)
To confirm nobody user has write access to logs sudo -u nobody touch logs/log1.txt

Had the same issue. renaming exec => exec_push in nginx.conf helped. Works in nginx 1.15.1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

evgenibers picture evgenibers  路  4Comments

ama-ableton picture ama-ableton  路  6Comments

Mattyzero picture Mattyzero  路  6Comments

ReeseWang picture ReeseWang  路  3Comments

MikuPanda picture MikuPanda  路  4Comments