nginx-rtmp-module
nginx-rtmp-module copied to clipboard
exec_push stdout, stderr shell style redirects not working
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.
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
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.