nginx-rtmp-module icon indicating copy to clipboard operation
nginx-rtmp-module copied to clipboard

exec_push stdout, stderr shell style redirects not working

Open DaveZheng opened this issue 7 years ago • 4 comments

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.

DaveZheng avatar Nov 28 '18 19:11 DaveZheng

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 avatar Jun 13 '19 18:06 monstarnn

@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

alexsorokoletov avatar Sep 25 '19 22:09 alexsorokoletov

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

mkrn avatar Mar 18 '20 01:03 mkrn

It worked for me with an older version (maybe 1.13) but today I updated to version 1.23.3 and the shell style redirect doesn't work anymore. Nginx doesn't write any files. I tried to grant nobody the necessary write access to the directory with sudo chown -R nobody:nogroup /logs and sudo chmod -R o+rw /logs and sudo chmod +x /logs but it doesn't work, even if all user have all rights: drwxrwxrwx+ 5 nobody admin 160 /logs. I am on a macOS Monterey machine and I installed nginx with homebrew. Any ideas? Thank you.

saltarob avatar Dec 31 '23 23:12 saltarob