15-Network Management and Monitoring Configuration Guide

HomeSupportRoutersCR16000-F SeriesConfigure & DeployConfiguration GuidesH3C CR16000-F Routers Configuration Guides-R8530Pxx-6W10115-Network Management and Monitoring Configuration Guide
21-Fast log output configuration
Title Size Download
21-Fast log output configuration 98.95 KB

Configuring fast log output

About fast log output

The fast log output feature enables fast output of logs to log hosts.

Typically, logs generated by a service module are first sent to the information center, which then outputs the logs to the specified destination (such as to log hosts). When fast log output is configured, logs of service modules are sent directly to log hosts instead of to the information center. Compared to outputting logs to the information center, fast log output saves system resources. For more information about the information center, see "Configuring the information center."

Log levels

Logs are classified into eight severity levels from 0 through 7 in descending order.

Table 1 Log levels

Severity value

Level

Description

0

Emergency

The system is unusable. For example, the system authorization has expired.

1

Alert

Action must be taken immediately. For example, traffic on an interface exceeds the upper limit.

2

Critical

Critical condition. For example, the device temperature exceeds the upper limit, the power module fails, or the fan tray fails.

3

Error

Error condition. For example, the link state changes.

4

Warning

Warning condition. For example, an interface is disconnected, or the memory resources are used up.

5

Notification

Normal but significant condition. For example, a terminal logs in to the device, or the device reboots.

6

Informational

Informational message. For example, a command or a ping operation is executed.

7

Debugging

Debug message.

Log formats and field descriptions

Log formats

The format of logs varies by log type. Table 2 shows the original log formats, which might be different from what you see. The actual format varies by the log resolution tool used.

Table 2 Log formats

Log type

Format

NAT session log

CMCC format:

<PRI> Version Timestamp HostName AppName ProcID MsgID Start Time|End Time|Original Source IP|OriginalSource Port|TranslatedSource IP|Translated Source Port|Destination IP|Destination Port|Protocol

Example:

<142> 1 2020 Apr 28 15:35:32 100.0.0.1 H3C - NAT444:SessionA 1588088133|0|100.0.0.18|1111|139.0.0.223|10000|114.0.0.15|2222|17

Telecom format:

<PRI> Version Timestamp HostName AppName ProcID MsgID [Protocol Original Source IP Original Source IPv6 Translated Source IP Original Source Port Translated Source Port -]

Example:

<134> 1 2020 Apr 28 15:35:38 100.0.0.1 H3C - NAT444:sessionbasedA [17 100.0.0.18 - 139.0.0.223 1111 11000 -]

Unicom format:

<PRI>Version Timestamp HostName AppName ProcID MsgID Start Time|End Time|Original Source IP |Translated Source IP|Translated Source Port|Destination IP|Destination Port|Protocol

Example:

<142> 1 2020 Apr 28 15:35:43 100.0.0.1 H3C - NAT444:SessionA 1588088144|0|100.0.0.18|139.0.0.223|12000|114.0.0.15|2222|17

NAT444 user log

CMCC format:

<PRI> Version Timestamp HostName AppName ProcID MsgID Start Time|Original Source IP|Translated Source IP|Translated First Source Port|Translated Last Source Port

Example:

<142> 1 2020 Apr 28 15:35:32 100.0.0.1 H3C - NAT444:PortA 1588088133|100.0.0.18|139.0.0.223|10000|10999

Telecom format:

<PRI> Version Timestamp HostName AppName ProcID MsgID [Protocol Original Source IP Original Source IPv6 Translated Source IP Original Source Port Translated First Source Port Translated Last Source Port]

Example:

<134> 1 2020 Apr 28 15:35:38 100.0.0.1 H3C - NAT444:userbasedA [17 100.0.0.18 - 139.0.0.223 - 11000 11999]

Unicom format:

<PRI> Version Timestamp HostName AppName ProcID MsgID Start Time|Original Source IP|Translated Source IP |Translated First Source Port|Translated Last Source Port

Example:

<142> 1 2020 Apr 28 15:35:43 100.0.0.1 H3C - NAT444:PortA 1588088144|100.0.0.18|139.0.0.223|12000|12999

NAT alarm log

CMCC format:

<PRI> Version Timestamp HostName AppName ProcID MsgID Start Time|Original Source IP|Translated Source IP

Example:

<142> 1 2020 Apr 28 15:35:32 100.0.0.1 H3C - NAT444:PortF 1588088133|100.0.0.18|139.0.0.223

Telecom format:

<PRI> Version Timestamp HostName AppName ProcID MsgID [Protocol Original Source IP Original Source IPv6 Translated Source IP - - -]

Example:

<134> 1 2020 Apr 28 15:35:38 100.0.0.1  H3C - NAT444:userbasedF [17 100.0.0.18 - 139.0.0.223 - - -]

Unicom format:

<PRI> Vision Timestamp HostName AppName ProcID MsgID StartTime|OriginalSourceIP|TranslatedSourceIP

Example:

<142> 1 2020 Apr 28 15:35:43 100.0.0.1 H3C - NAT444:PortF 1588088144|100.0.0.18|139.0.0.223

Log field description

Each log message contains a header and MSG content, which records log identifier information and detailed log information, respectively. Table 3 displays descriptions of log fields in the header and content.

Table 3 Log field description

Field

Description

Header

PRI

Priority identifier. The priority is calculated by using this formula: facility*8+level, where:

·     facility is the facility name used to identify the log source at the log host. The facility name is fixed to 17, 16, and 17 for CMCC, Telecom, and Unicom, respectively.

·     level is in the range of 0 to 7. See Table 1 for more information about severity levels.

Version

Version of the log. This field is fixed to 1.

Timestamp

Time when the log was generated, accurate to seconds. The timestamp format is <year><mon> <day> <hh:mm:ss>, where:

·     year represents the year.

·     mon represents the month.

·     day represents the date.

·     hh:mm:ss represents the exact time.

You can execute the customlog timestamp localtime command to configure the timestamp of fast output logs to show the system time. By default, the timestamp shows the Greenwich Mean Time (GMT).

HostName

Source IP address of the log. If the customlog host source command is configured, this field displays the IP address of the specified source interface. Otherwise, this field displays a hyphen (-).

AppName

Name of the device that generated the log. You can use the sysname command to modify the name of the device.

ProcID

Reserved field.

This field displays a hyphen (-).

MsgID

Log message type in the format of <device type>:<message type>.

The device type is NAT444, DSLITE, and NAT64 for NAT444, DS-Lite, and NAT64 networks, respectively.

Available message types include:

·     UserbasedA—Specifies user-based port assignment log.

·     UserbasedW—Specifies user-based port withdrawal log.

·     SessionbasedA—Specifies session-based port assignment log.

·     SessionbasedW—Specifies session-based port withdrawal log.

·     PortA—Specifies port range assignment log.

·     PortF—Specifies port range insufficient resource log.

·     PortW—Specifies port range withdrawal log.

·     SessionA—Specifies session start log.

·     SessionW—Specifies session end log.

·     SessionU—Specifies session log with a session URL.

MSG content

Protocol

Transmission layer protocol. Options include:

·     6—TCP.

·     17—UDP.

·     1—ICMP.

Start Time

NAT session start time, seconds elapsed since 1970-1-1 00:00:00.

End Time

NAT session end time, seconds elapsed since 1970-1-1 00:00:00. This field is 0 in a session start log message.

Original Source IP

Source IPv4 address before NAT.

Original Source IPv6

Source IPv6 address before NAT.

Original Source Port

Source port number before NAT.

Translated Source IP

Source IPv4 address after NAT.

Translated First Source port

First source port number after NAT.

Translated Last Source port

Last source port number after NAT.

Destination IP

Destination IP address.

Destination Port

Destination port number.

Restrictions and guidelines: fast log output configuration

The device supports outputting logs from service modules to log hosts by using the following methods in descending order of priority:

1.     Fast log output. Only NAT logs and AFT logs can be output by using this method in the current software version. For more information about NAT logs, see NAT configuration in ‍‍NAT Configuration Guide. For more information about AFT logs, see AFT configuration in Layer 3—IP Services Configuration Guide.

2.     Flow log. For more information about flow log and the service modules supported by flow log, see "Configuring flow log."

3.     Information center.

If you configure multiple log output methods for a service module, the service module outputs its logs in the method that has the highest priority.

To output NAT logs to a log host, you must specify the log format required by the log host in the customlog format and customlog host commands.

The device does not support outputting fast logs through the network management interface.

Procedure

1.     Enter system view.

system-view

2.     Enable fast log output.

customlog format { cmcc | telecom | unicom [ type1 ] } [ with-brackets ]

By default, fast log output is disabled.

3.     Configure fast log output parameters.

customlog host [ vpn-instance vpn-instance-name ] { hostname | ipv4-address | ipv6 ipv6-address } [ port port-number ] export { cmcc-sessionlog | cmcc-userlog | telecom-sessionlog | telecom-userlog | unicom-sessionlog | unicom-userlog } * [ sysname sysname ]

By default, no fast log output parameters are configured.

The value for the port-number argument must be the same as the port number configured on the log host. Otherwise, the log host cannot receive logs.

4.     (Optional.) Specify the source IP address for fast log output.

customlog host source interface-type interface-number

By default, the source IP address of fast output logs is the primary IP address of the outgoing interface.

If this command is configured, the primary IP address of the specified interface is used as the source IP address of fast output logs regardless of the outgoing interface.

Configure this command when you need to filter logs by source IP address on the log host.

5.     (Optional.) Configure the timestamp of fast output logs to show the system time.

customlog timestamp localtime

By default, the timestamp of fast output logs shows the Greenwich Mean Time (GMT).

Fast log output configuration examples

Example: Configuring fast log output to a log host

Network configuration

As shown in Figure 1, configure fast log output on the device to send NAT444 user logs to the log host in CMCC format.

Figure 1 Network diagram

Procedure

1.     Make sure the device and the log host can reach each other. (Details not shown.)

2.     Configure the device:

# Enable fast log output in CMCC format.

<Device> system-view

[Device] customlog format cmcc

# Output NAT444 user logs in CMCC format to the log host at 1.2.0.1/16.

[Device] customlog host 1.2.0.1 port 1000 export cmcc-userlog

# Enable NAT444 user log.

[Device] nat log enable

[Device] nat log port-block-assign

[Device] nat log port-block-withdraw

3.     Configure the log host:

The log host configuration varies by log host. For more information, see related document of the log host.

 

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become A Partner
  • Partner Policy & Program
  • Global Learning
  • Partner Sales Resources
  • Partner Business Management
  • Service Business
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网