IOx Logging/Tracing Facility

IOx App-hosting Logging/Tracing is designed to provide logging service for guest applications to report error, debug, and information data to the host file system and to the IOS Console and Syslog facility. To support logging data to IOS syslog and to IOX tracelog on the host machine, two serial devices, /dev/ttyS2 and /dev/ttyS3, are designated for the service. Guest application can log data to IOS syslog and console log buffer through /dev/ttyS2, and log data to IOS tracelog through /dev/ttyS3. Both /dev/ttyS2 and /dev/ttyS3 are only accessible by guest application, but not by the host.

Below diagram highlights the major components used to support the IOx Logging/Tracing facility.

ISR4K

  • /dev/ttyS2 prepends a timestamp to any message sent to the device. Messages are then forwarded to the IOS syslog server if configured, and the IOS logging console.

Sample IOS logging console application message:

*Apr  7 00:48:21.911: %IM-5-IOX_INST_NOTICE:ioxman:  IOX SERVICE guestshell LOG: Guestshell test
  • /dev/ttyS3 prepends a timestamp to any message sent to the device. Messages re then forwarded to the host-os file tracing facility which provides automatic file timestamping and file rotation. The created Application trace filenames are named “iox__.bin.gz”.

Sample application tracelog message:

04/07/2017 00:11:18.746
systemd[1]: systemd-logind.service holdoff time over, scheduling restart.

NOTE If an external syslog server is required, standard IP networking access through the switch/router's data port connected to the applications VPG connection can be used. Other than the typical syslog configuration file changes pointing to the external syslog server's IP, no other special drivers or IOX specific devices are required.

Application Setup to Enable IOX Logging/Tracing

Application Logging

To enable the IOX logging/tracing facility, an IOX needs to implement one of the sample setups below.

  • BusyBox/systemd linux:

Add “start-stop-daemon -S -b -n syslogd -a /bin/bash -- -c "exec /sbin/syslogd -n -O - -l 5 |& tee -a /var/log/messages /dev/ttyS3" to /etc/init.d/syslog.busybox.

  • CentOS:

    1. Configure /etc/systemdl/system.conf.
    [Manager]
    LogLevel=debug
    LogTarget=journal
    
    1. Configure /etc/systemd/journald.conf.
    [Journal]
    ForwardToConsole=yes
    TTYPath=/dev/ttyS3
    

Application Tracing

Output tracing data from guest application to the host can be done by the following methods.

  • For C programmer, use write() to send data to host.
    For example:
     #define SYSLOG_TEST       “syslog test”
     int fd;
     fd = open("/dev/ttyS2", O_WRONLY);
     write(fd, strlen(SYSLOG_TEST), SYSLOG_TEST);
     close(fd);
  • From shell console, use echo to send data to host.
    For example:
     echo “syslog test” > /dev/ttyS2

IOX IOS CLI Logging/Tracing Support Commands

The following IOS CLI exec CLI commands provide logging/tracing support for the application files created.

  • “show logging” displays the application specific messages sent to the IOS logging console.
Switch#show logging
Syslog logging: enabled (0 messages dropped, 1 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled)

No Active Message Discriminator.



No Inactive Message Discriminator.


    Console logging: level debugging, 135 messages logged, xml disabled,
                     filtering disabled
    Monitor logging: level debugging, 0 messages logged, xml disabled,
                     filtering disabled
    Buffer logging:  level debugging, 135 messages logged, xml disabled,
                    filtering disabled
    Exception Logging: size (4096 bytes)
    Count and timestamp logging messages: disabled
    File logging: disabled
    Persistent logging: disabled

No active filter modules.

    Trap logging: level informational, 134 message lines logged
        Logging Source-Interface:       VRF Name:

Log Buffer (4096 bytes):

...

*Apr  7 00:48:21.911: %IM-5-IOX_INST_NOTICE:ioxman:  IOX SERVICE guestshell LOG: Guestshell test
  • Use the below “app-hosting move” to capture App specific tracelogs if they exist. Moved App tracefiles are gziped text files with the filenames:

iox_(APP-ID)_(MOVE_TIMESTAMP).bin.gz

cat9k-2#app-hosting move appid wireshark log to bootflash:
Successfully moved tracelog to bootflash:
iox_ wireshark_R0-0.13102_0.20180314095020.bin.gz