TritonDataCenter / sdc-vmtools-lx-brand

The guest tools for lx-brand images
https://docs.joyent.com/images/container-native-linux
Mozilla Public License 2.0
7 stars 10 forks source link

boot scripts' logging is stomping over /var/log/triton.log #23

Closed trentm closed 7 years ago

trentm commented 7 years ago

"/lib/smartdc/common.lib" has this:

LOG='/var/log/triton.log'
touch $LOG
exec 4<> $LOG
export PS4='[\D{%FT%TZ}] ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
export BASH_XTRACEFD=4
set -o xtrace

Most of the boot scripts in /lib/smartdc are sourcing common.lib. That's resulting in multiple processes overwriting triton.log such that content is lost. Here is an example showing messed up results: https://gist.github.com/trentm/6702d5d81a5d3816ba5ee9062546ee07

The suggestions from discussion were to do one of:

  1. do the redirect to "triton.log" in joyent_rc.local instead of in common.lib; or
  2. update to exec 4<>> $LOG to append
chorrell commented 7 years ago

I'm going to opt for 2. for now since it's the easiest change and will test it. I'll look into 1. if the issue isn't solved.

chorrell commented 7 years ago

using exec 4<>> $LOG causes an error:

/lib/smartdc/common.lib: line 10: syntax error near unexpected token `>'
/lib/smartdc/common.lib: line 10: `exec 4<>> $LOG'
/lib/smartdc/mdata-fetch: line 21: smartdc_info: command not found
/lib/smartdc/mdata-fetch: line 23: user-data: command not found
/lib/smartdc/mdata-fetch: line 34: smartdc_fatal: command not found
/lib/smartdc/mdata-fetch: line 38: smartdc_info: command not found
/lib/smartdc/mdata-fetch: line 39: user-script: command not found
/lib/smartdc/mdata-fetch: line 51: smartdc_fatal: command not found
/lib/smartdc/mdata-fetch: line 55: smartdc_info: command not found
/lib/smartdc/mdata-fetch: line 56: sdc:operator-script: command not found
/lib/smartdc/mdata-fetch: line 68: smartdc_fatal: command not found
.
.
.
chorrell commented 7 years ago

Moving the redirect to "triton.log" in joyent_rc.local instead of in common.lib seems to be the better way to go so far.

chorrell commented 7 years ago

I have a proposed fix that I will be testing today: https://github.com/joyent/sdc-vmtools-lx-brand/pull/25