VRF-Aware Source Interface for Syslog Transactions

Last Updated: October 15, 2012

The VRF Aware Source Interface for Syslog Transactions feature provides logging source-interface setting capability to Virtual Routing and Forwarding (VRF) syslog destinations on a per-VRF basis.

Finding Feature Information

Your software release may not support all the features documented in this module. For the latest caveats and feature information, see Bug Search Tool and the release notes for your platform and software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the feature information table at the end of this module.

Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.

Information About VRF-Aware Source Interfaces for Syslog Transactions

VRF-Aware Source Interfaces for Syslog Transactions

The VRF Aware Source Interfaces for Syslog Transactions feature allows logging source-interface setting capability to VRF syslog destinations on a per-VRF basis. Syslog packets can be configured to be sent to hosts with a desired source IP address. This source IP address is typically the interface source address and can be subjected to interface up and down events. The logging source-interface command allows the user to configure the desired source IP address (usually a loopback address) enabling the syslog listeners to filter packets coming from a fixed address.

How to Configure VRF-Aware Source Interfaces for Syslog Transactions

Configuring VRF-Aware Source Interfaces for Syslog Transactions

Perform this task to enable a VRF interface to be configured as the source interface when syslog messages are been exported to a VRF host.

SUMMARY STEPS

1.    enable

2.    configure terminal

3.    logging source-interface type numbervrfnumber

4.    end

5.    show running interface type numbervrf number

6.   show running | include logging


DETAILED STEPS
  Command or Action Purpose
Step 1
enable


Example:

Device> enable

 

Enables privileged EXEC mode.

  • Enter your password if prompted.
 
Step 2
configure terminal


Example:

Device# configure terminal

 

Enters global configuration mode.

 
Step 3
logging source-interface type numbervrfnumber


Example:

Device(config)# logging source-interface ethernet 0

 

Configures the syslog packets that contain the IPv4 or IPv6 address of a particular interface and specifies the source interface for syslog messages sent to remote syslog hosts.

  • Normally, a syslog message sent to remote hosts will use whatever interface is available at the time of the message generation. This command forces the device to send syslog messages to remote hosts only from the specified interface.
 
Step 4
end


Example:

Device(config)# end

 

Ends your current configuration session and returns the CLI to privileged EXEC mode.

 
Step 5
show running interface type numbervrf number


Example:

Device# show running interface loopback 49 vrf 1

 

Specifies the source IPV4 or IPv6 address of system logging packets.

 
Step 6
show running | include logging


Example:

Device# show running | include logging

 

Specifies the source IPV4 or IPv6 address of system logging packets.

 

Configuration Examples for VRF-Aware Source Interfaces for Syslog Transactions

Example: Configuring VRF-Aware Source Interfaces for Syslog Transactions

In the following example, a VRF interface is configured as the source interface when sending syslog messages to a VRF host:

Device> enable
Device# configure terminal
Device(config)# logging source-interface ethernet 0 vrf1 
Device(config)# end
Device> show running interface loopback 49
Device> show running | include logging
Device# show running interface loopback 49

             Building configuration...
             Current configuration : 84 bytes
             !
             interface Loopback49
              ip vrf forwarding vrf1
              ip address 10.4.2.39 255.0.0.0
             end
Device# show running | includes logging
      logging source-interface Loopback49 vrf1
      logging host 192.0.2.1 vrf1

Example: Source IP Tagging

The logging source-interface CLI command can be used to specify a source IP address in all syslog packets sent from the device. The following syslog filter module example demonstrates the use of show CLI commands (show running-config and show ip interface in this case) within a filter module to add the source IP address to syslog messages. The script looks for the local namespace variable "source_ip::init" first. If the variable is not defined in the first syslog message processed, the filter will run the show commands and use regular expressions to get the source interface and then its IP address.

Note that in this script the show commands are run only once. If the source interface or its IP address were to be changed, the filter would have to be reinitialized to pick up the new information. (You could have the show commands run on every syslog message, but this practice would not scale very well.)

#  ===================================================================
#  Embedded Syslog Manager                           ||        ||
#                                                    ||        ||
#  Source IP Module                                 ||||      ||||
#                                               ..:||||||:..:||||||:..
#                                             ------------------------
#                                              C i s c o  S y s t e m s 
#   ===================================================================
# Usage: Adds Logging Source Interface IP address to all messages.
#
# Namespace:source_ip
#
#  ======================= End User Setup ==============================
namespace eval ::source_ip {
    if { [info exists init] == 0 } {
       if { [catch {regexp {^logging source-interface (.*$)} [exec show
run | inc logging source-interface] match source_int}]} {
           set suffix "No source interface specified"
       } elseif { [catch {regexp {Internet address is (.*)/.*$} [exec
show ip int $source_int | inc Internet] match ip_addr}]} {
           set suffix "No IP address configured for source interface"
       } else {
           set suffix $ip_addr
       }
       set init 1
    }
 
    if { [string length $::orig_msg] == 0} {
      return ""
    }
    return "$::orig_msg - $suffix"
} ;# end namespace source_ip

Additional References for VRF-Aware Source Interfaces for Syslog Transactions

Related Documents

Related Topic Document Title

Cisco IOS commands

Cisco IOS Master Commands List, All Releases

Network Management commands (including logging commands): complete command syntax, defaults, command mode, command history, usage guidelines, and examples

Cisco IOS Network Management Command Reference

Syslog logging

Troubleshooting and Fault Management module

Standards and RFCs

Standard/RFC Title

No new or modified standards/RFCs are supported by this feature, and support for existing standards/RFCs has not been modified by this feature.

--

MIBs

MIB MIBs Link

No new or modified MIBs are supported by this feature, and support for existing MIBs has not been modified by this feature.

To locate and download MIBs for selected platforms, Cisco software releases, and feature sets, use Cisco MIB Locator found at the following URL:

http://www.cisco.com/go/mibs

Technical Assistance

Description Link

The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password.

http://www.cisco.com/cisco/web/support/index.html

Feature Information for VRF-Aware Source Interfaces for Syslog Transactions

The following table provides release information about the feature or features described in this module. This table lists only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise, subsequent releases of that software release train also support that feature.

Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.

Table 1 Feature Information for VRF Aware Source Interfaces for Syslog Transactions
Feature Name Releases Feature Information

VRF Aware Source Interfaces for Syslog Transactions

11.2

12.2(33)SRA

12.2SX

12.4(4)T

15.1(1)SY

The VRF-Aware Source Interface for Syslog Transactions feature allows logging source-interface setting capability to VRF syslog destinations on a per-VRF basis.

The following command was introduced or modified: logging source-interface.

Cisco and the Cisco logo are trademarks or registered trademarks of Cisco and/or its affiliates in the U.S. and other countries. To view a list of Cisco trademarks, go to this URL: www.cisco.com/go/trademarks. Third-party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1110R)

Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental.

© 2000-2012 Cisco Systems, Inc. All rights reserved.