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 based on the site requirements.
- Create the DPDK log directory.
1mkdir -p /var/log/dpdk
- Configure the Rsyslog configuration file of DPDK.
- Create the dpdk.conf configuration file in the /etc/rsyslog.d directory.
1vim /etc/rsyslog.d/dpdk.conf
- Add the following content to the file:
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 }
- Create the dpdk.conf configuration file in the /etc/rsyslog.d directory.
- Configure the DPDK log rollback file.
- Create the /etc/logrotate.d/dpdk file.
vim /etc/logrotate.d/dpdk
- Add the following content to the file:
1 2 3 4 5 6 7 8 9
/var/log/dpdk/dpdk.log { hourly compress missingok notifempty maxsize 2048k rotate 50 copytruncate }
- Create the /etc/logrotate.d/dpdk file.
- Configure the OVS log rollback file.
- Create the /etc/logrotate.d/openvswitch file.
1vim /etc/logrotate.d/openvswitch
- Add the following content to the file:
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 }
- Create the /etc/logrotate.d/openvswitch file.
- Configure the scheduled log processing file.
- Create the ovslogrotat file in /etc/cron.hourly.
1vim /etc/cron.hourly/ovslogrotate
- Add the following content to the file:
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
- Add the read and execute permissions to the file.
1 2
chmod 0644 /etc/cron.hourly/ovslogrotate chmod +x /etc/cron.hourly/ovslogrotate
- Create the ovslogrotat file in /etc/cron.hourly.
Parent topic: XPF User Guide