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.
- Create a DPDK log directory.
1mkdir -p /var/log/dpdk
- Configure the Rsyslog configuration file of DPDK.
- Create a dpdk.conf file in the /etc/rsyslog.d directory.
1vim /etc/rsyslog.d/dpdk.conf - 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 }
- Press Esc to exit the insert mode. Input :wq! and press Enter to save the file and exit.
- Create a dpdk.conf file in the /etc/rsyslog.d directory.
- Configure the DPDK log rollback file.
- Create an /etc/logrotate.d/dpdk file.
vim /etc/logrotate.d/dpdk
- 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 }
- Press Esc to exit the insert mode. Input :wq! and press Enter to save the file and exit.
- Create an /etc/logrotate.d/dpdk file.
- Configure the OVS log rollback file.
- Create an /etc/logrotate.d/openvswitch file.
1vim /etc/logrotate.d/openvswitch - 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 }
- Press Esc to exit the insert mode. Input :wq! and press Enter to save the file and exit.
- Create an /etc/logrotate.d/openvswitch file.
- Configure the scheduled log processing file.
- Create an ovslogrotate file in /etc/cron.hourly.
1vim /etc/cron.hourly/ovslogrotate - 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
- Press Esc to exit the insert mode. Input :wq! and press Enter to save the file and exit.
- Add the read and execute permissions to the file.
1 2
chmod 0644 /etc/cron.hourly/ovslogrotate chmod +x /etc/cron.hourly/ovslogrotate
- Create an ovslogrotate file in /etc/cron.hourly.
Parent topic: OVS Flow Table Normalization