i'm trying to forward syslog to logentries.com which requires a line added to /etc/rsyslog.conf , so far so good. however, i'm running on amazon elastic beanstalk and have 3 environments (dev,staging,prod) that i'd like to route to different ports based on the environment (logentries differentiates the environment based on the port it's forwarded on)
i created an apache site running at port 8001 that just outputs the port i want to use for this specific server (since elastic beanstalk container properties get appended to the php.ini, i needed a way to output php.ini variables). then i wrote a script:
#!/bin/bash
LOGENTRIES_PORT=`curl 127.0.0.1:8001`
if [ "${LOGENTRIES_PORT}" == '' ]; then
exit -1
fi
echo "*.* @@46.51.181.128:${LOGENTRIES_PORT}" >> /etc/rsyslog.conf
service rsyslog restart
which works great when run from the terminal but i can't seem to run on startup.
i've stuck it inside /etc/rc.d/rc.local
, i've put it in /etc/rc.d/rc3.d/S99logentries
(with 777
perms) with no luck. any ideas why this might be?