cisco — Logging and Tracing of Messages

Logging Messages in Cisco IOS Syslog For any logging messages received from a guest application, IOXMAN sets the severity of the message to NOTICE by default, before sending it to the Cisco IOS syslog. When a message is received by IOSd, it is displayed on the console and saved on the syslog in the following message format: *Apr 7 00:48:21.911: %IM-5-IOX_INST_NOTICE:ioxman: IOX SERVICE guestshell LOG: Guestshell test To comply with the Cisco IOS syslog, the IOXMAN does support severity levels for logging messages. To report logging messages with severity, a guest application must append a header to the front of the message. [a123b234,version,severity] a123b234 is magic number. Version:

severity support version. Current version is 1. Severity: CRIT is 2 ERR is 3 WARN is 4 NOTICE is 5 INFO is 6 DEBUG is 7 The following is an example of a message log: echo “[a123b234,1,2]Guestshell failed” > /dev/ttyS2 Perform the following steps to report logging data from a guest application to the Cisco IOS syslog: 1. If you are using C programming, use write() to send logging data to the host. #define SYSLOG_TEST “syslog test” int fd; fd = open("/dev/ttyS2", O_WRONLY); write(fd, SYSLOG_TEST, strlen(SYSLOG_TEST)); close(fd); 2. If you are using a Shell console, use echo to send logging data to the host.

echo “syslog test” > /dev/ttyS2 Tracing Message to IOx Tracelog Perform the following steps to report tracing messages from a guest application to IOx tracelog: 1. If you are using C programming, use write() to send tracing message to the host. #define SYSLOG_TEST “tracelog test” int fd; fd = open("/dev/ttyS3", O_WRONLY); write(fd, SYSLOG_TEST, strlen(SYSLOG_TEST)); close(fd); 2. If you are using C programming, use syslog() to send tracing message to the host. #define SYSLOG_TEST “tracelog test” syslog(LOG_INFO, “%s\n”, SYSLOG_TEST); Guest Shell Logging and Tracing of Messages Guest Shell 11