Rate This Document
Findability
Accuracy
Completeness
Readability

Configuring Logs

DPDK logs are output to dmesg by default. To facilitate fault locating, modify configuration files to output DPDK logs to OVS log files and configure log control methods. Perform the following configuration as required.

  1. Create a DPDK log directory.
    1
    mkdir -p /var/log/dpdk
    
  2. Configure the Rsyslog configuration file of DPDK.
    1. Create a dpdk.conf file in the /etc/rsyslog.d directory.
      1
      vim /etc/rsyslog.d/dpdk.conf
      
    2. Press I to enter the insert mode and add the following content:
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      #DPDK_LOG_TAG "LibLogTag_DPDK"
      template(name="template-dpdk" type="string" string="%TIMESTAMP:::date-rfc3339%|%syslogseverity-text%|%programname%[%PROCID%]|%$!msg_pre%%$!msg_after%\n")
      $outchannel dpdk,/var/log/dpdk/dpdk.log,2097152,/opt/esyslog/esyslog_log_rsyslog_dump.sh /var/log/dpdk/dpdk.log dpdk
      
      if ($msg contains "LibLogTag_DPDK" and $syslogseverity <= 7 ) then {
      set $!msg_pre = field($msg,"LibLogTag_DPDK|",1);
      set $!msg_after = field($msg,"LibLogTag_DPDK|",2);
      :omfile:$dpdk;template-dpdk
      stop
      }
      
      
      if ($msg contains "LibLogTag_DPDK" and $syslogseverity > 7 ) then {
      /dev/null
      stop
      }
      
    3. Press Esc to exit the insert mode. Input :wq! and press Enter to save the file and exit.
  3. Configure the DPDK log rollback file.
    1. Create an /etc/logrotate.d/dpdk file.
      vim /etc/logrotate.d/dpdk
    2. Press I to enter the insert mode and add the following content:
      1
      2
      3
      4
      5
      6
      7
      8
      9
      /var/log/dpdk/dpdk.log {
      hourly
      compress
      missingok
      notifempty
      maxsize 2048k
      rotate 50
      copytruncate
      }
      
    3. Press Esc to exit the insert mode. Input :wq! and press Enter to save the file and exit.
  4. Configure the OVS log rollback file.
    1. Create an /etc/logrotate.d/openvswitch file.
      1
      vim /etc/logrotate.d/openvswitch
      
    2. Press I to enter the insert mode and add the following content:
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      # Copyright (C) 2009, 2010, 2011, 2012 Nicira, Inc.
      #
      # Copying and distribution of this file, with or without modification,
      # are permitted in any medium without royalty provided the copyright
      # notice and this notice are preserved.  This file is offered as-is,
      # without warranty of any kind.
      
      /var/log/openvswitch/*.log {
          su root root
          hourly
          compress
          missingok
          maxsize 2048k
          rotate 50
          sharedscripts
          postrotate
              # Tell Open vSwitch daemons to reopen their log files
              if [ -d /var/run/openvswitch ]; then
                  for ctl in /var/run/openvswitch/*.ctl; do
                      ovs-appctl -t "$ctl" vlog/reopen 2>/dev/null || :
                  done
              fi36
          endscript
      }
      
    3. Press Esc to exit the insert mode. Input :wq! and press Enter to save the file and exit.
  5. Configure the scheduled log processing file.
    1. Create an ovslogrotate file in /etc/cron.hourly.
      1
      vim /etc/cron.hourly/ovslogrotate
      
    2. Press I to enter the insert mode and add the following content:
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      #!/bin/sh
      
      /usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.d/dpdk
      EXITVALUE=$?
      if [ $EXITVALUE != 0 ]; then
          /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
      fi
      
      /usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.d/openvswitch
      EXITVALUE=$?
      if [ $EXITVALUE != 0 ]; then
          /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
      fi
      
      exit 0
      
    3. Press Esc to exit the insert mode. Input :wq! and press Enter to save the file and exit.
    4. Add the read and execute permissions to the file.
      1
      2
      chmod 0644 /etc/cron.hourly/ovslogrotate
      chmod +x /etc/cron.hourly/ovslogrotate