This section describes how to configure a log host using the config method.
Operation |
XPATH |
---|---|
edit-config:config |
/ietf-syslog:syslog/log-actions/remote/destination |
Data requirement 1
Item |
Data |
Description |
---|---|---|
Address of a log host |
huawei |
Indicates that the configured log host address is a domain name. |
Port number of a log host |
43 |
Indicates the configured port number of a log host. |
Logging tool of a log host |
local0 |
Indicates the configured logging tool of a log host. |
Source interface used to send logs to a log host |
GigabitEthernet0/0/1 |
Indicates the configured source interface used to send logs to a log host. Ensure that this interface exists and has been configured on the device. For details about the configuration, see Configuring Basic Attributes of an Interface. |
Request example
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="3" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<running/>
</target>
<config>
<syslog:syslog xmlns:syslog="urn:ietf:params:xml:ns:yang:ietf-syslog">
<syslog:log-actions>
<syslog:remote>
<syslog:destination>
<syslog:name>NEED-A-VALUE-FOR-KEY-NODE!</syslog:name>
<syslog:udp>
<syslog:address>huawei</syslog:address>
<syslog:port>43</syslog:port>
</syslog:udp>
<syslog:destination-facility xmlns:ietf-syslog-types="urn:ietf:params:xml:ns:yang:ietf-syslog-types">ietf-syslog-types:local0</syslog:destination-facility>
<syslog:source-interface>GigabitEthernet0/0/1</syslog:source-interface>
</syslog:destination>
</syslog:remote>
</syslog:log-actions>
</syslog:syslog>
</config>
</edit-config>
</rpc>
Response example
Sample of successful response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="8"> <ok/> </rpc-reply>
Sample of failed response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="9"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-message>parse rpc config error.</error-message> </rpc-error> </rpc-reply>
Data requirement 2
Item |
Data |
Description |
---|---|---|
Address of a log host |
fc00:0:0:3001::1 |
Indicates that the configured log host address is an IPv6 address. |
Port number of a log host |
43 |
Indicates the configured port number of a log host. |
Logging tool of a log host |
local0 |
Indicates the configured logging tool of a log host. |
Source interface used to send logs to a log host |
GigabitEthernet0/0/1 |
Indicates the configured source interface used to send logs to a log host. |
Request example
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="9" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<running/>
</target>
<config>
<syslog:syslog xmlns:syslog="urn:ietf:params:xml:ns:yang:ietf-syslog">
<syslog:log-actions>
<syslog:remote>
<syslog:destination>
<syslog:name>NEED-A-VALUE-FOR-KEY-NODE!</syslog:name>
<syslog:udp>
<syslog:address>fc00:0:0:3001::1</syslog:address>
<syslog:port>43</syslog:port>
</syslog:udp>
<syslog:destination-facility xmlns:ietf-syslog-types="urn:ietf:params:xml:ns:yang:ietf-syslog-types">ietf-syslog-types:local0</syslog:destination-facility>
<syslog:source-interface>GigabitEthernet0/0/1</syslog:source-interface>
</syslog:destination>
</syslog:remote>
</syslog:log-actions>
</syslog:syslog>
</config>
</edit-config>
</rpc>
Response example
Sample of successful response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="8"> <ok/> </rpc-reply>
Sample of failed response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="9"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-message>parse rpc config error.</error-message> </rpc-error> </rpc-reply>
Data requirement 3
Item |
Data |
Description |
---|---|---|
Address of a log host |
192.168.1.5 |
Indicates that the configured log host address is an IPv4 address. |
Port number of a log host |
43 |
Indicates the configured port number of a log host. |
Logging tool of a log host |
local0 |
Indicates the configured logging tool of a log host. |
Source interface used to send logs to a log host |
GigabitEthernet0/0/1 |
Indicates the configured source interface used to send logs to a log host. |
Replacement example
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="4" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<running/>
</target>
<config>
<syslog:syslog xmlns:syslog="urn:ietf:params:xml:ns:yang:ietf-syslog">
<syslog:log-actions>
<syslog:remote>
<syslog:destination>
<syslog:name>NEED-A-VALUE-FOR-KEY-NODE!</syslog:name>
<syslog:udp>
<syslog:address xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="replace">192.168.1.5</syslog:address>
<syslog:port>43</syslog:port>
</syslog:udp>
<syslog:destination-facility xmlns:ietf-syslog-types="urn:ietf:params:xml:ns:yang:ietf-syslog-types">ietf-syslog-types:local0</syslog:destination-facility>
<syslog:source-interface>GigabitEthernet0/0/1</syslog:source-interface>
</syslog:destination>
</syslog:remote>
</syslog:log-actions>
</syslog:syslog>
</config>
</edit-config>
</rpc>
Response example
Sample of successful response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="8"> <ok/> </rpc-reply>
Sample of failed response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="9"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-message>parse rpc config error.</error-message> </rpc-error> </rpc-reply>
Data requirement 4
Item |
Data |
Description |
---|---|---|
Address of a log host |
192.168.1.5 |
Indicates that the deleted log host address is an IPv4 address. |
Port number of a log host |
43 |
Indicates the deleted port number of a log host. |
Logging tool of a log host |
local0 |
Indicates the deleted logging tool of a log host. |
Source interface used to send logs to a log host |
GigabitEthernet0/0/1 |
Indicates the deleted source interface used to send logs to a log host. |
Deletion example
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="7" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<running/>
</target>
<config>
<syslog:syslog xmlns:syslog="urn:ietf:params:xml:ns:yang:ietf-syslog">
<syslog:log-actions>
<syslog:remote>
<syslog:destination xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete">
<syslog:name>NEED-A-VALUE-FOR-KEY-NODE!</syslog:name>
<syslog:udp>
<syslog:address>192.168.1.5</syslog:address>
<syslog:port>43</syslog:port>
</syslog:udp>
<syslog:destination-facility xmlns:ietf-syslog-types="urn:ietf:params:xml:ns:yang:ietf-syslog-types">ietf-syslog-types:local0</syslog:destination-facility>>
<syslog:source-interface>GigabitEthernet0/0/1</syslog:source-interface>
</syslog:destination>
</syslog:remote>
</syslog:log-actions>
</syslog:syslog>
</config>
</edit-config>
</rpc>
Response example
Sample of successful response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="8"> <ok/> </rpc-reply>
Sample of failed response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="9"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-message>parse rpc config error.</error-message> </rpc-error> </rpc-reply>