Accounting Log for RESTCONF Agent
For write operations such as POST, PUT, PATCH, or DELETE, RESTCONF would emit the relevant accounting log. It would include
both the original received request, as well as the eventual changes applied to the switch.
You can see the accounting log using the show accounting log command.
Consider the following example request:
---
curl -s -L --request POST --user admin: --header 'Content-Type: application/yang.data+json' --url “restconf/data/Cisco-NX-OS-device:System/intf-items/lb-items/LbRtdIf-list=lo10” --data-raw @request.txt
Payload:
<descr>test</descr>
Or
{"descr":"test"}
---
The accounting log shall include the following items:
Table 3. Changes applied to the switch
Item |
Description |
Context |
Session ID and user |
Operation |
COMMIT/ABORT |
Database |
Running or Candidate |
ConfigMO |
MO tree’s text representation. Up to 3K characters. |
Status |
SUCCESS/FAILED |
Example:
Wed Jun 29 13:53:37
2022:type=update:id=3180018864:user=admin:cmd=(COMMIT),database=[running],configMo=[ <topSystem childAction="" dn="sys" status="created,modified"><interfaceEntity childAction=""
rn="intf" status="created,modified"><l3LbRtdIf childAction="" descr="test" id="lo10" rn="lb-
[lo10]" status="created,modified"/></interfaceEntity></topSystem>] (SUCCESS)
Table 4. Original received request
Item |
Description |
Context |
Session ID and user |
Operation |
RESTCONF:POST, RESTCONF:PUT, RESTCONF:PATCH, RESTCONF:DELETE |
Source IP |
RESTCONF Client IP |
URL |
HTTP URL |
Payload |
Received XML/JSON Request. Up to 3K characters. |
Status |
SUCCESS/FAILED |
Example:
Wed Jun 29 13:53:37
2022:type=update:id=3180018864:user=admin:cmd=(RESTCONF:POST),sourceIp=[192.168.1.2], url=[/restconf/data/Cisco-NX-OS-device:System/intf-items/lb-items/LbRtdIflist=lo10],payload=[<descr>test</descr>] (SUCCESS)
In case of failed request, based on the failed scenarios, a user may not observe both the logs.
Invalid request:
The invalid request would be rejected without making a configuration change, thus only the original request would be logged.
Example:
Wed Jun 29 20:16:26
2022:type=update:id=3180018864:user=admin:cmd=(RESTCONF:POST),
sourceIp=[192.168.1.2],url=[/restconf/data/Cisco-NX-OS-device:System/intf-items/lb-items/LbRtdIflist=lo10],payload=[<descr>test</descr>] (FAILED)
Request fails due to various configuration restrictions:
In this case, both the failed configuration attempt and the original request would be logged.
Example:
Wed Jun 29 20:32:01
2022:type=update:id=3180018864:user=admin:cmd=(COMMIT),database=[running], configMo=[<topSystem childAction="" dn="sys" status="created,modified"><telemetryEntity
childAction="" rn="tm" status="created,modified"><telemetryCertificate childAction="" filename="foo" hostname="foo" rn="certificate" status="created,modified" trustpoint="test"/></telemetryEntity></topSystem>] (FAILED)
Wed Jun 29 20:32:01
2022:type=update:id=3180018864:user=admin:cmd=(RESTCONF:PATCH),
sourceIp=[192.168.1.2],url=[/restconf/data/Cisco-NX-OS-device:System/tm-items/certificateitems],payload=[<trustpoint>test</trustpoint><hostname>foo</hostname><filename> foo</filename>] (FAILED)