Installation‎ > ‎

Logging

Orabuntu-LXC logs the installation using sudo and sudoreplay.  The logs of install sessions are stored at /opt/olxc/installs/logs.  The typical code that creates the logging facility is shown below (this example is from anylinux-services.VM.ON.HUB.HOST.1500).

if [ ! -d "$DistDir"/installs/logs ]
then
        sudo mkdir -p "$DistDir"/installs/logs
fi

if [ -f "$DistDir"/installs/logs/$USER.log ]
then
        sudo mv "$DistDir"/installs/logs/$USER.log "$DistDir"/installs/logs/$USER.log.$LOGEXT
fi

if [ ! -d /var/log/sudo-io ]
then
        sudo mkdir -m 750 /var/log/sudo-io
fi

if [ ! -f /etc/sudoers.d/orabuntu-lxc ]
then
        sudo sh -c "echo 'Defaults      logfile=\"$DistDir/installs/logs/$USER.log\"'                      >> /etc/sudoers.d/orabuntu-lxc"
        sudo sh -c "echo 'Defaults      log_input,log_output'                                                           >> /etc/sudoers.d/orabuntu-lxc"
        sudo sh -c "echo 'Defaults      iolog_dir=/var/log/sudo-io/%{user}'                                             >> /etc/sudoers.d/orabuntu-lxc"
        sudo chmod 0440 /etc/sudoers.d/orabuntu-lxc
fi

During the install the logging can be monitored by using the following command as shown below.

[ubuntu@oracle76b logs]$ pwd
/opt/olxc/installs/logs
[ubuntu@oracle76b logs]$ ls -lrt
total 1284
-rw-r--r--. 1 ubuntu ubuntu 889205 Apr 14 12:30 ubuntu.log
[ubuntu@oracle76b logs]$ sudo tail -f ubuntu.log
[sudo] password for ubuntu:
    ; USER=root ; TSID=0002ZB ; COMMAND=/bin/lxc-create -n oel76c13 -t oracle --
    --release=7.6
Apr 14 12:29:17 : ubuntu : TTY=pts/0 ;
    PWD=/home/ubuntu/Downloads/orabuntu-lxc-6.11.5-beta/anylinux ; USER=root ;
    COMMAND=validate
Apr 14 12:30:17 : ubuntu : TTY=pts/0 ;
    PWD=/home/ubuntu/Downloads/orabuntu-lxc-6.11.5-beta/anylinux ; USER=root ;
    COMMAND=validate
Apr 14 12:30:30 : ubuntu : TTY=pts/1 ; PWD=/opt/olxc/installs/logs ; USER=root ;
    TSID=0002ZC ; COMMAND=/bin/tail -f ubuntu.log
Apr 14 12:31:17 : ubuntu : TTY=pts/0 ;
    PWD=/home/ubuntu/Downloads/orabuntu-lxc-6.11.5-beta/anylinux ; USER=root ;
    COMMAND=validate

The sudoreplay facility can then be used to actually play back the entire install session as a video.  The session playback can be speeded up or slowed down to quickly get to a specific phase of the install.

For example, to replay the actual install result for any step that involved "lxc-2.0.8-1.el7.x86_64.rpm" that was built from source code by Orabuntu-LXC during the install, the following steps could be used as shown below.


[ubuntu@oracle76b logs]$ sudo sudoreplay -l | grep -A2 -B2 lxc-2.0.8-1.el7.x86_64.rpm

Apr 14 11:51:53 2019 : ubuntu : TTY=/dev/pts/0 ; CWD=/opt/olxc/home/ubuntu/Downloads/orabuntu-lxc-6.11.5-beta/uekulele/lxc ; USER=root ; TSID=ubuntu/00/02/RA ; COMMAND=/bin/sed -i /sysconfig/s/\*// /opt/olxc//home/ubuntu/Downloads/orabuntu-lxc-6.11.5-beta/uekulele/lxc/lxc.spec
Apr 14 11:51:53 2019 : ubuntu : TTY=/dev/pts/0 ; CWD=/opt/olxc/home/ubuntu/Downloads/orabuntu-lxc-6.11.5-beta/uekulele/lxc ; USER=root ; TSID=ubuntu/00/02/RB ; COMMAND=/bin/sh -c echo '%_unpackaged_files_terminate_build 0' >> /etc/rpm/macros
Apr 14 11:55:54 2019 : ubuntu : TTY=/dev/pts/0 ; CWD=/opt/olxc/home/ubuntu/Downloads/orabuntu-lxc-6.11.5-beta/uekulele/lxc/rpmbuild/RPMS/x86_64 ; USER=root ; TSID=ubuntu/00/02/RC ; COMMAND=/bin/yum -y localinstall lxc-2.0.8-1.el7.x86_64.rpm lxc-debuginfo-2.0.8-1.el7.x86_64.rpm lxc-devel-2.0.8-1.el7.x86_64.rpm lxc-libs-2.0.8-1.el7.x86_64.rpm
Apr 14 11:56:16 2019 : ubuntu : TTY=/dev/pts/0 ; CWD=/opt/olxc/home/ubuntu/Downloads/orabuntu-lxc-6.11.5-beta/uekulele/lxc ; USER=root ; TSID=ubuntu/00/02/RD ; COMMAND=/bin/lxc-checkconfig
Apr 14 11:56:26 2019 : ubuntu : TTY=/dev/pts/0 ; CWD=/opt/olxc/home/ubuntu/Downloads/orabuntu-lxc-6.11.5-beta/uekulele/lxc ; USER=root ; TSID=ubuntu/00/02/RE ; COMMAND=/sbin/ifconfig virbr0

[ubuntu@oracle76b logs]$ sudo sudoreplay ubuntu/00/02/RC

Replaying sudo session: /bin/yum -y localinstall lxc-2.0.8-1.el7.x86_64.rpm lxc-debuginfo-2.0.8-1.el7.x86_64.rpm lxc-devel-2.0.8-1.el7.x86_64.rpm lxc-libs-2.0.8-1.el7.x86_64.rpm
Loaded plugins: langpacks, ulninfo
Examining lxc-2.0.8-1.el7.x86_64.rpm: lxc-2.0.8-1.el7.x86_64
Marking lxc-2.0.8-1.el7.x86_64.rpm as an update to lxc-1.1.5-2.0.11.el7.x86_64
Examining lxc-debuginfo-2.0.8-1.el7.x86_64.rpm: lxc-debuginfo-2.0.8-1.el7.x86_64
Marking lxc-debuginfo-2.0.8-1.el7.x86_64.rpm to be installed
Examining lxc-devel-2.0.8-1.el7.x86_64.rpm: lxc-devel-2.0.8-1.el7.x86_64
Marking lxc-devel-2.0.8-1.el7.x86_64.rpm to be installed
Examining lxc-libs-2.0.8-1.el7.x86_64.rpm: lxc-libs-2.0.8-1.el7.x86_64
Marking lxc-libs-2.0.8-1.el7.x86_64.rpm as an update to lxc-libs-1.1.5-2.0.11.el7.x86_64
Resolving Dependencies
--> Running transaction check
---> Package lxc.x86_64 0:1.1.5-2.0.11.el7 will be updated
---> Package lxc.x86_64 0:2.0.8-1.el7 will be an update
---> Package lxc-debuginfo.x86_64 0:2.0.8-1.el7 will be installed
---> Package lxc-devel.x86_64 0:2.0.8-1.el7 will be installed
---> Package lxc-libs.x86_64 0:1.1.5-2.0.11.el7 will be updated
---> Package lxc-libs.x86_64 0:2.0.8-1.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================================================================================
 Package                                         Arch                                     Version                                        Repository                                                           Size
===================================================================================================================================================================================================================
Installing:
 lxc-debuginfo                                   x86_64                                   2.0.8-1.el7                                    /lxc-debuginfo-2.0.8-1.el7.x86_64                                   3.8 M
 lxc-devel                                       x86_64                                   2.0.8-1.el7                                    /lxc-devel-2.0.8-1.el7.x86_64                                        38 k
Updating:
 lxc                                             x86_64                                   2.0.8-1.el7                                    /lxc-2.0.8-1.el7.x86_64                                             959 k
 lxc-libs                                        x86_64                                   2.0.8-1.el7                                    /lxc-libs-2.0.8-1.el7.x86_64                                        688 k

Transaction Summary
===================================================================================================================================================================================================================
Install  2 Packages
Upgrade  2 Packages

Total size: 5.5 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : lxc-libs-2.0.8-1.el7.x86_64                                                                                                                                                                     1/6
  Updating   : lxc-2.0.8-1.el7.x86_64                                                                                                                                                                          2/6
/var/tmp/rpm-tmp.yKJgxS: line 14: /usr/local/etc/default/lxc-net: No such file or directory
warning: %post(lxc-2.0.8-1.el7.x86_64) scriptlet failed, exit status 1
Non-fatal POSTIN scriptlet failure in rpm package lxc-2.0.8-1.el7.x86_64
  Installing : lxc-devel-2.0.8-1.el7.x86_64                                                                                                                                                                    3/6
  Installing : lxc-debuginfo-2.0.8-1.el7.x86_64                                                                                                                                                                4/6
  Cleanup    : lxc-1.1.5-2.0.11.el7.x86_64                                                                                                                                                                     5/6
  Cleanup    : lxc-libs-1.1.5-2.0.11.el7.x86_64                                                                                                                                                                6/6
  Verifying  : lxc-2.0.8-1.el7.x86_64                                                                                                                                                                          1/6
  Verifying  : lxc-debuginfo-2.0.8-1.el7.x86_64                                                                                                                                                                2/6
  Verifying  : lxc-devel-2.0.8-1.el7.x86_64                                                                                                                                                                    3/6
  Verifying  : lxc-libs-2.0.8-1.el7.x86_64                                                                                                                                                                     4/6
  Verifying  : lxc-1.1.5-2.0.11.el7.x86_64                                                                                                                                                                     5/6
  Verifying  : lxc-libs-1.1.5-2.0.11.el7.x86_64                                                                                                                                                                6/6

Installed:
  lxc-debuginfo.x86_64 0:2.0.8-1.el7                                                                         lxc-devel.x86_64 0:2.0.8-1.el7                                                                        

Updated:
  lxc.x86_64 0:2.0.8-1.el7                                                                              lxc-libs.x86_64 0:2.0.8-1.el7                                                                             

Complete!
[ubuntu@oracle76b logs]$

Note that when the command "sudo sudoreplay ubunt/00/02/RC" runs, what is shown in terminal is a recording of the the actual session played back.





Comments