Logging a Message About a Commit Operation

To record a message in the /var/log/commits file when a commit operation succeeds, a client application encloses the <log> tag element in <commit-configuration> and <rpc> tag elements:

<rpc>
<commit-configuration>
<log>message</log>
</commit-configuration>
</rpc>

The <log> tag element can be combined with other tag elements within the <commit-configuration> tag element (the <at-time>, <confirmed/>, and <confirm-timeout>, or <synchronize/> tag elements) and does not change the effect of the operation. When the <log> tag element is emitted by itself, the associated commit operation begins immediately.

The following example shows how to log a message as the candidate configuration is committed.

Image t1154.gif

The /var/log/commits file includes an entry for each pending commit and up to 50 previous commits. To request the contents of the file, a client application encloses the <get-commit-information/> tag in <rpc> tag elements:

<rpc>
<get-commit-information/>
</rpc>

(The equivalent operational mode CLI command is show system commit.) The Junos XML protocol server encloses the information in <commit-information> and <rpc-reply> tag elements. For information about the child tag elements of the <commit-information> tag element, see its entry in the Junos XML API Operational Reference.

<rpc-reply xmlns:junos="URL">
<commit-information>
<!-- tag elements representing the commit log -->
</commit-information>
</rpc-reply>

The following example shows how to request the commit log.

Image t1183.gif