cache (Flexible NetFlow)
To configure the flow cache parameter for a Flexible NetFlow flow monitor, use the cache command in Flexible NetFlow flow monitor configuration mode. To remove a flow cache parameter for a Flexible NetFlow flow monitor, use the no form of this command.
cache {entries number | timeout {active seconds | event transaction-end | inactive seconds | update seconds | synchronized interval [ export-spread [ spread-interval]] } | type {immediate | normal | permanent | synchronized}}
no cache {entries | timeout {active | event transaction-end | inactive | update | synchronized} | type {immediate | normal | permanent | synchronized}}
Syntax Description
entries number |
Specifies the maximum number of entries in the flow monitor cache. The range is from 16 to 2000000.
|
||
timeout active seconds |
Specifies the active flow timeout in seconds. The range is from 1 to 604800 (7 days). The default is 1800. |
||
timeout event transaction-end |
Specifies that the record is generated and exported in the NetFlow cache at the end of a transaction. |
||
timeout inactive seconds |
Specifies the inactive flow timeout in seconds. The range is from 1 to 604800 (7 days).The default is 15. |
||
timeout update seconds |
Specifies the update timeout, in seconds, for a permanent flow cache. The range is from 1 to 604800 (7 days). The default is 1800. |
||
timeout synchronized interval |
Specifies the synchronized interval timeout value. The range is from 1 to 300. |
||
export-spread |
Enables export spreading. |
||
spread-interval |
The export spreading interval in seconds. The valid period is 5 or 6. |
||
type |
Specifies the type of the flow cache. |
||
immediate |
Configures an immediate cache type. This cache type will age out every record as soon as it is created. |
||
normal |
Configures a normal cache type. The entries in the flow cache will be aged out according to the timeout active seconds and timeout inactive seconds settings. This is the default cache type. |
||
permanent |
Configures a permanent cache type. This cache type disables flow removal from the flow cache. |
||
synchronized |
Configures a synchronized cache type. |
Command Default
The default Flexible NetFlow flow monitor flow cache parameters are used.
The following flow cache parameters for a Flexible NetFlow flow monitor are enabled:
-
Cache type: normal
-
Maximum number of entries in the flow monitor cache: 4096
-
Active flow timeout: 1800 seconds
-
Inactive flow timeout: 15 seconds
-
Update timeout for a permanent flow cache: 1800 seconds
Command Modes
Flexible NetFlow flow monitor configuration (config-flow-monitor)
Command History
Release |
Modification |
---|---|
12.4(9)T |
This command was introduced. |
12.2(31)SB2 |
This command was integrated into Cisco IOS Release 12.2(31)SB2. |
12.0(33)S |
This command was modified. Support for this command was implemented on the Cisco 12000 series routers. |
12.2(33)SRC |
This command was modified. Support for this command implemented on the Cisco 7200 series routers. |
12.2(33)SRE |
This command was modified. Support for this command was implemented on the Cisco 7300 Network Processing Engine (NPE) series routers. |
Cisco IOS XE Release 3.1S |
This command was integrated into Cisco IOS XE Release 3.1S. |
Cisco IOS XE Release 3.4S |
This command was modified. The event transaction-end keyword was added. |
Cisco IOS XE Release 3.2SE |
This command was integrated into Cisco IOS XE Release 3.2SE with support for the timeout and type normal keywords only. |
Cisco IOS XE Release 3.11S |
This command was modified. The export-spread keyword was added. The update keyword was removed. |
Usage Guidelines
Each flow monitor has a cache that it uses to store all the flows it monitors. Each cache has various configurable elements, such as the number of entries and the time that a flow is allowed to remain in it. When a flow times out, it is removed from the cache and sent to any exporters that are configured for the corresponding flow monitor.
If a cache is already active (that is, you have applied the flow monitor to at least one interface in the router), your changes to the record, cache type, and cache size parameters will not take effect until you either reboot the router or remove the flow monitor from every interface and then reapply it. Therefore whenever possible you should customize the record, cache type, and cache size parameters for the cache before you apply the flow monitor to an interface. You can modify the timers, flow exporters, and statistics parameters for a cache while the cache is active.
cache entries
This command controls the size of the cache. Cache size should be based on a number of factors, including the number of flows expected, the time the flows are expected to last (based on the configured key fields and the traffic), and the timeout values configured for the cache. The size should be large enough to minimize emergency expiry.
Emergency expiry is caused by the Flexible NetFlow cache becoming full. When the Flexible NetFlow cache becomes full, the router performs “emergency expiry” where a number of flows are immediately aged, expired from the Flexible NetFlow cache, and exported in order to free up space for more flows.
For a permanent cache (flows never expire), the number of entries should be large enough to accommodate the number of flows expected for the entire duration of the cache entries. If more flows occur than there are cache entries, the excess flows are not recorded in the cache.
For an immediate cache (flows expire immediately), the number of entries simply controls the amount of history that is available for previously seen packets.
cache timeout active
This command controls the aging behavior of the normal type of cache. If a flow has been active for a long time, it is usually desirable to age it out (starting a new flow for any subsequent packets in the flow). This age out process allows the monitoring application that is receiving the exports to remain up to date. By default this timeout is 1800 seconds (30 minutes), but it can be adjusted according to system requirements. A larger value ensures that long-lived flows are accounted for in a single flow record; a smaller value results in a shorter delay between starting a new long-lived flow and exporting some data for it.
cache timeout event transaction-end
To use this command, you must configure the match connection transaction id command and the match application name command for the flow record. This command causes the record to be generated and exported in the NetFlow cache at the end of a transaction. A transaction is a set of logical exchanges between endpoints. There is normally one transaction within a flow.
cache timeout inactive
This command controls the aging behavior of the normal type of cache. If a flow has not seen any activity for a specified amount of time, that flow will be aged out. By default, this timeout is 15 seconds, but this value can be adjusted depending on the type of traffic expected.
If a large number of short-lived flows is consuming many cache entries, reducing the inactive timeout can reduce this overhead. If a large number of flows frequently get aged out before they have finished collecting their data, increasing this timeout can result in better flow correlation.
cache timeout update
This command controls the periodic updates sent by the permanent type of cache. This behavior is similar to the active timeout, except that it does not result in the removal of the cache entry from the cache. By default, this timer value is 1800 seconds (30 minutes).
cache timeout synchronized interval [ export-spread [ spread-interval]]
This command configures export spreading on a synchronized cache. As asynchronous monitors need to aggregate the data in a few seconds, you can enable and configure export spreading only when you configure the synchronized interval timeout value to more than 10 seconds. Export spreading might start a couple of seconds after the interval ends in order to complete the aggregation. No export spreading option is visible on the CLI if the synchronized interval timeout value is lower than 10 seconds. The default export spread interval is 30 seconds.
cache type immediate
This command specifies the immediate cache type. This type of cache will age out every record as soon as it is created, with the result that every flow contains just one packet. The commands that display the cache contents will provide a history of the packets seen.
The use of this cache type is appropriate when very small flows are expected and a minimum amount of latency between analyzing a packet and exporting a report is desired. We recommend using this command when you are sampling packet chunks because the number of packets per flow is typically very low.
Caution |
This command may result in a large amount of export data that can overload low speed links and overwhelm any systems to which you are exporting. We recommended that you configure sampling to reduce the number of packets seen. |
Note |
The timeout settings have no effect for the immediate cache type. |
cache type normal
This command specifies the normal cache type. This is the default cache type. The entries in the cache will be aged out according to the timeout active seconds and timeout inactive seconds settings. When a cache entry is aged out, it is removed from the cache and exported via any exporters configured for the monitor associated with the cache.
cache type permanent
This command specifies the permanent cache type. This type of cache never ages out any flows. This cache type is useful when the number of flows you expect to see has a limit and there is a need to keep long-term statistics on the router. For example, if the only key field is IP TOS, a limit of 256 flows can be seen, so to monitor the long-term usage of the IP TOS field, a permanent cache can be used. Update messages are exported via any exporters configured for the monitor associated with this cache in accordance with the timeout update seconds setting.
Note |
When a cache becomes full, new flows will not be monitored. If this occurs, a “Flows not added” statistic will appear in the cache statistics. |
Note |
A permanent cache uses update counters rather than delta counters. This means that when a flow is exported, the counters represent the totals seen for the full lifetime of the flow and not the additional packets and bytes seen since the last export was sent. |
Examples
The following example shows how to configure the number of entries for the flow monitor cache:
Device(config)# flow monitor FLOW-MONITOR-1
Device(config-flow-monitor)# cache entries 16
The following example shows how to configure the active timeout for the flow monitor cache:
Device(config)# flow monitor FLOW-MONITOR-1
Device(config-flow-monitor)# cache timeout active 4800
The following example shows how to configure the inactive timer for the flow monitor cache:
Device(config)# flow monitor FLOW-MONITOR-1
Device(config-flow-monitor)# cache timeout inactive 3000
The following example shows how to configure the permanent cache update timeout:
Device(config)# flow monitor FLOW-MONITOR-1
Device(config-flow-monitor)# cache timeout update 5000
The following example shows how to enable and configure export spreading where the synchronized interval timeout value is 12 seconds and the export spread interval is 5 seconds:
Device(config)# flow monitor FLOW-MONITOR-1
Device(config-flow-monitor)# cache type synchronized
Device(config-flow-monitor)# cache timeout synchronized 12 export-spread 5
The following example shows how to configure a normal cache:
Device(config)# flow monitor FLOW-MONITOR-1
Device(config-flow-monitor)# cache type normal
The following example shows how to configure a permanent cache:
Device(config)# flow monitor FLOW-MONITOR-1
Device(config-flow-monitor)# cache type permanent
The following example shows how to configure an immediate cache:
Device(config)# flow monitor FLOW-MONITOR-1
Device(config-flow-monitor)# cache type immediate