Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i'm trying to forward syslog to 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:

if [ "${LOGENTRIES_PORT}" == '' ]; then
  exit -1

echo "*.* @@${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?

share|improve this question
Can you tell how far your script actually gets when run from, say, rc.local? Do you see the new line in /etc/rsyslog.conf? – cjc Jul 4 '12 at 15:42
up vote 1 down vote accepted

The "old" trick to run a script as cron job or at boot time is redirect the stderr and stdout to a file to see what happens:

/path/to/your/script > /var/log/script.log 2>&1

Also keep in mind that: always use the absolute path of a command. Change the final line to /sbin/service rsyslog restart and try again.

PS: NEVER chmod 777 for a shell script!

share|improve this answer
i ended up doing this (not sure why it took me so long) and i was able to determine that apache wasn't ready by the time the script ran. after some more research i found i could get the php ini setting via the command line without apache (php -r '$foo = ini_get("ini_var_name"); var_dump($foo);') – hackerhasid Jul 5 '12 at 14:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.