17 lines
455 B
Bash
17 lines
455 B
Bash
#!/bin/sh
|
|
|
|
# Fail if there's no options provided
|
|
test -n "$ACCESS_LOGS_FLAGS" || exit 1
|
|
|
|
# Remove access.log and recreate it as a fifo
|
|
rm -f /var/log/nginx/access.log /run/access_log.pid
|
|
mkfifo /var/log/nginx/access.log
|
|
chmod 755 /var/log/nginx/access.log
|
|
|
|
# Reopen log file
|
|
nginx -s reload
|
|
|
|
# Read from fifo and load into database
|
|
daemonize -p /run/access_logd.pid -u nobody \
|
|
/bin/sh -c "cat /var/log/nginx/access.log | access_log $ACCESS_LOGS_FLAGS"
|