<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Automating custom syslog messages in Tools</title>
    <link>https://community.cisco.com/t5/tools/automating-custom-syslog-messages/m-p/3567665#M3075</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, hopefully, we don't have to rely on Syslog much longer for network management, but, for the time being, let's see how to automate custom Syslog messages.&amp;nbsp; Cisco IOS XR has allowed you to generate custom Syslog messages for quite some time.&amp;nbsp; Historically, those messages were generated using the "logmsg" CLI command:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;RP/0/RP0/CPU0:Router#logmsg ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LINE&amp;nbsp; message to be sent to syslog&lt;/P&gt;
&lt;P&gt;RP/0/RP0/CPU0:Router#logmsg A custom syslog message&lt;/P&gt;
&lt;P&gt;Tue Dec 13 12:42:36.213 UTC&lt;/P&gt;
&lt;P&gt;RP/0/RP0/CPU0:Router#&lt;/P&gt;
&lt;P&gt;RP/0/RP0/CPU0:Router#sh log | i syslog&lt;/P&gt;
&lt;P&gt;Tue Dec 13 12:43:18.884 UTC&lt;/P&gt;
&lt;P&gt;RP/0/RP0/CPU0:Dec 13 12:42:36.296 : logger[65705]: %OS-SYSLOG-6-LOG_INFO : A custom syslog message &lt;/P&gt;
&lt;P&gt;RP/0/RP0/CPU0:Router#&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the world of data models, we don't want to automate this command using CLI.&amp;nbsp; CIsco IOS XR 6.1.2 already specifies this command in the "&lt;A class="js-navigation-open" href="https://github.com/YangModels/yang/blob/master/vendor/cisco/xr/612/Cisco-IOS-XR-syslog-act.yang" style="background-color: #f5f5f5; color: #4078c0; text-decoration: underline; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;" title="Cisco-IOS-XR-syslog-act.yang"&gt;Cisco-IOS-XR-syslog-act&lt;/A&gt;" YANG model.&amp;nbsp; Now, using YDK 0.5.2 with Cisco-IOS-XR module bundle 6.1.2, you can instantiate an &lt;A href="http://ydk.cisco.com/py/docs/gen_doc_dddff6e705c2aa919a4c8c795341238aa3cab2fa.html"&gt;RPC object for this model&lt;/A&gt;, provide the input parameter and use the Executor service to execute the RPC.&amp;nbsp; How is it done?&amp;nbsp; Look at these Python sample apps:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;A href="https://github.com/CiscoDevNet/ydk-py-samples/commit/722dd36d1b215cc17d77a30f8c0c2156b2a4779b"&gt;nc-execute-xr-syslog-act-20-ydk.py&lt;/A&gt; - custom informational message ("A custom informational message")&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;RP/0/RP0/CPU0:Dec 12 16:20:37.744 : netconf[1101]: %OS-SYSLOG-6-LOG_INFO : A custom informational message&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://github.com/CiscoDevNet/ydk-py-samples/commit/722dd36d1b215cc17d77a30f8c0c2156b2a4779b"&gt;nc-execute-xr-syslog-act-22-ydk.py&lt;/A&gt; - custom warning message ("A custom warning message")&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;RP/0/RP0/CPU0:Dec 12 16:27:39.847 : netconf[1101]: %OS-SYSLOG-4-LOG_WARNING : A custom warning message&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://github.com/CiscoDevNet/ydk-py-samples/commit/722dd36d1b215cc17d77a30f8c0c2156b2a4779b"&gt;nc-execute-xr-syslog-act-24-ydk.py&lt;/A&gt; - custom critical message ("A custom critical message")&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;RP/0/RP0/CPU0:Dec 12 16:29:47.854 : netconf[1101]: %OS-SYSLOG-2-LOG_CRIT : A custom critical message&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As always, you can fing a boilerplate app that you can use to create your own:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/CiscoDevNet/ydk-py-samples/commit/722dd36d1b215cc17d77a30f8c0c2156b2a4779b"&gt;nc-execute-xr-syslog-act-10-ydk.py&lt;/A&gt; - execute boilerplate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Give them a try!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Dec 2016 22:00:32 GMT</pubDate>
    <dc:creator>saalvare</dc:creator>
    <dc:date>2016-12-13T22:00:32Z</dc:date>
    <item>
      <title>Automating custom syslog messages</title>
      <link>https://community.cisco.com/t5/tools/automating-custom-syslog-messages/m-p/3567665#M3075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, hopefully, we don't have to rely on Syslog much longer for network management, but, for the time being, let's see how to automate custom Syslog messages.&amp;nbsp; Cisco IOS XR has allowed you to generate custom Syslog messages for quite some time.&amp;nbsp; Historically, those messages were generated using the "logmsg" CLI command:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;RP/0/RP0/CPU0:Router#logmsg ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LINE&amp;nbsp; message to be sent to syslog&lt;/P&gt;
&lt;P&gt;RP/0/RP0/CPU0:Router#logmsg A custom syslog message&lt;/P&gt;
&lt;P&gt;Tue Dec 13 12:42:36.213 UTC&lt;/P&gt;
&lt;P&gt;RP/0/RP0/CPU0:Router#&lt;/P&gt;
&lt;P&gt;RP/0/RP0/CPU0:Router#sh log | i syslog&lt;/P&gt;
&lt;P&gt;Tue Dec 13 12:43:18.884 UTC&lt;/P&gt;
&lt;P&gt;RP/0/RP0/CPU0:Dec 13 12:42:36.296 : logger[65705]: %OS-SYSLOG-6-LOG_INFO : A custom syslog message &lt;/P&gt;
&lt;P&gt;RP/0/RP0/CPU0:Router#&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the world of data models, we don't want to automate this command using CLI.&amp;nbsp; CIsco IOS XR 6.1.2 already specifies this command in the "&lt;A class="js-navigation-open" href="https://github.com/YangModels/yang/blob/master/vendor/cisco/xr/612/Cisco-IOS-XR-syslog-act.yang" style="background-color: #f5f5f5; color: #4078c0; text-decoration: underline; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;" title="Cisco-IOS-XR-syslog-act.yang"&gt;Cisco-IOS-XR-syslog-act&lt;/A&gt;" YANG model.&amp;nbsp; Now, using YDK 0.5.2 with Cisco-IOS-XR module bundle 6.1.2, you can instantiate an &lt;A href="http://ydk.cisco.com/py/docs/gen_doc_dddff6e705c2aa919a4c8c795341238aa3cab2fa.html"&gt;RPC object for this model&lt;/A&gt;, provide the input parameter and use the Executor service to execute the RPC.&amp;nbsp; How is it done?&amp;nbsp; Look at these Python sample apps:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;A href="https://github.com/CiscoDevNet/ydk-py-samples/commit/722dd36d1b215cc17d77a30f8c0c2156b2a4779b"&gt;nc-execute-xr-syslog-act-20-ydk.py&lt;/A&gt; - custom informational message ("A custom informational message")&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;RP/0/RP0/CPU0:Dec 12 16:20:37.744 : netconf[1101]: %OS-SYSLOG-6-LOG_INFO : A custom informational message&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://github.com/CiscoDevNet/ydk-py-samples/commit/722dd36d1b215cc17d77a30f8c0c2156b2a4779b"&gt;nc-execute-xr-syslog-act-22-ydk.py&lt;/A&gt; - custom warning message ("A custom warning message")&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;RP/0/RP0/CPU0:Dec 12 16:27:39.847 : netconf[1101]: %OS-SYSLOG-4-LOG_WARNING : A custom warning message&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://github.com/CiscoDevNet/ydk-py-samples/commit/722dd36d1b215cc17d77a30f8c0c2156b2a4779b"&gt;nc-execute-xr-syslog-act-24-ydk.py&lt;/A&gt; - custom critical message ("A custom critical message")&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;RP/0/RP0/CPU0:Dec 12 16:29:47.854 : netconf[1101]: %OS-SYSLOG-2-LOG_CRIT : A custom critical message&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As always, you can fing a boilerplate app that you can use to create your own:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/CiscoDevNet/ydk-py-samples/commit/722dd36d1b215cc17d77a30f8c0c2156b2a4779b"&gt;nc-execute-xr-syslog-act-10-ydk.py&lt;/A&gt; - execute boilerplate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Give them a try!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Dec 2016 22:00:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/automating-custom-syslog-messages/m-p/3567665#M3075</guid>
      <dc:creator>saalvare</dc:creator>
      <dc:date>2016-12-13T22:00:32Z</dc:date>
    </item>
  </channel>
</rss>

