<?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>question Clear log entry? in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370939#M27865</link>
    <description>&lt;P&gt;Hi folks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have just been asked by my colleague who is experimenting Credit Card Regex test to find out records with credit card number pattern. &amp;nbsp; &amp;nbsp; &amp;nbsp; The sys_log has been written for testing but he wonders if the logs can be cleared?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
    <pubDate>Thu, 17 Dec 2015 00:35:43 GMT</pubDate>
    <dc:creator>georgechen</dc:creator>
    <dc:date>2015-12-17T00:35:43Z</dc:date>
    <item>
      <title>Clear log entry?</title>
      <link>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370939#M27865</link>
      <description>&lt;P&gt;Hi folks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have just been asked by my colleague who is experimenting Credit Card Regex test to find out records with credit card number pattern. &amp;nbsp; &amp;nbsp; &amp;nbsp; The sys_log has been written for testing but he wonders if the logs can be cleared?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2015 00:35:43 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370939#M27865</guid>
      <dc:creator>georgechen</dc:creator>
      <dc:date>2015-12-17T00:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: Clear log entry?</title>
      <link>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370940#M27866</link>
      <description>&lt;P&gt;Hi George,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;By default table syslog is a rotated table (System Definition -&amp;gt; Table Rotations) with a default configuration of 8 rotations, 7 days each. This means it only stores data for 56 days, and it's cleaned automatically.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;A href="http://wiki.servicenow.com/index.php?title=Table_Rotation#gsc.tab=0" title="http://wiki.servicenow.com/index.php?title=Table_Rotation#gsc.tab=0"&gt;Table Rotation - ServiceNow Wiki&lt;/A&gt; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;If you really need to have the table cleaned now, you will probably have to open an incident to ServiceNow support.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Sergiu&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Dec 2015 09:00:28 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370940#M27866</guid>
      <dc:creator>sergiu_panaite</dc:creator>
      <dc:date>2015-12-18T09:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Clear log entry?</title>
      <link>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370941#M27867</link>
      <description>&lt;P&gt;If it just for temporary purpose, you can open the delete ACL on syslog table and remove the 'nobody' role from 'Require Roles' related list. That should make the delete button visible. Add the 'nobody' role back to the ACL once done.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I am sure ServiceNow will not recommend doing it.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Dec 2015 09:15:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370941#M27867</guid>
      <dc:creator>Kalaiarasan Pus</dc:creator>
      <dc:date>2015-12-18T09:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Clear log entry?</title>
      <link>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370942#M27868</link>
      <description>&lt;P&gt;Hi George,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I did clear some log statements using background scripts in developer instance in past.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;That worked perfect for me. But seriously I dont know the implications of performing this operation in live prod instance.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;the code which I used was something like&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var deleteObj = new GlideRecord('syslog');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var encodedQry = "Encoded query should go here";&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;deleteObj .addEncodedQuery(encodedQry);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;deleteObj.query();&lt;/P&gt;&lt;BR /&gt;&lt;ADDRESS&gt;&lt;EM&gt;gs.print(deleteObj.getRowCount());&lt;/EM&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;EM&gt;Run this much of code only for 1st time to see how many records are returned for deletion purpose.&lt;/EM&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;EM&gt;Once you see that records are under control and only count matches to your encoded query filter, you can go on and delete those by using below code.&lt;/EM&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;P&gt;var deleteObj = new GlideRecord('syslog');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var encodedQry = "Encoded query should go here";&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;deleteObj .addEncodedQuery(encodedQry);&lt;/P&gt;&lt;BR /&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;deleteObj.query();&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;EM&gt;while(deleteObj.next()){&lt;/EM&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;deleteObj.deleteRecord();&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;EM&gt;&lt;EM&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;EM&gt;&lt;EM&gt;&lt;EM&gt;Note: Please check if this has any cons using this operation.&lt;/EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;EM&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;EM&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;EM&gt;&lt;EM&gt;&lt;EM&gt;&lt;A title="pradeepksharma" __default_attr="7836" __jive_macro_name="user" class="jive_macro jive_macro_user" data-orig-content="pradeepksharma" data-renderedposition="619_8_127_16" href="https://www.servicenow.com/community?id=community_user_profile&amp;amp;user=ce3fce65db181fc09c9ffb651f96192f"&gt;pradeepksharma&lt;/A&gt;, &lt;A title="rfedoruk" __default_attr="2291" __jive_macro_name="user" class="jive_macro jive_macro_user" data-orig-content="rfedoruk" data-renderedposition="619_143_72_16" href="https://www.servicenow.com/community?id=community_user_profile&amp;amp;user=5aa25e6ddbd81fc09c9ffb651f961921"&gt;rfedoruk&lt;/A&gt; &lt;A title="bernyalvarado" __default_attr="34736" __jive_macro_name="user" class="jive_macro jive_macro_user" data-orig-content="bernyalvarado" data-renderedposition="619_219_110_16" href="https://www.servicenow.com/community?id=community_user_profile&amp;amp;user=d16f4e29db181fc09c9ffb651f9619b5"&gt;bernyalvarado&lt;/A&gt; &lt;/EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/ADDRESS&gt;&lt;ADDRESS&gt;&lt;EM&gt;&lt;EM&gt;&lt;EM&gt;Any comments are much appriciated.&lt;/EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/ADDRESS&gt;</description>
      <pubDate>Fri, 18 Dec 2015 12:58:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370942#M27868</guid>
      <dc:creator>Deepak Ingale1</dc:creator>
      <dc:date>2015-12-18T12:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: Clear log entry?</title>
      <link>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370943#M27869</link>
      <description>&lt;P&gt;Deepak, &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;If you need to delete million or records, using GlideRecord is not the fastest way. &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;If you don't need to full syslog shard (the active table from Rotations for syslog) then you can just ask ServiceNow to truncate it for you. It's much faster and no real performance impact on the production instance (but you will lose all records from the table).&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;If you need only to delete based on a particular criteria (like the encoded query) you can use GlideRecord deleteMultiple (&lt;A href="http://wiki.servicenow.com/index.php?title=GlideRecord#Delete_Methods" title="http://wiki.servicenow.com/index.php?title=GlideRecord#Delete_Methods"&gt;GlideRecord - ServiceNow Wiki&lt;/A&gt; ), but again, if you have millions of records is not going to be very fast. Even so, impact over the instance should not be high.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Sergiu&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Dec 2015 13:25:41 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370943#M27869</guid>
      <dc:creator>sergiu_panaite</dc:creator>
      <dc:date>2015-12-18T13:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Clear log entry?</title>
      <link>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370944#M27870</link>
      <description>&lt;P&gt;You can try below script &amp;nbsp; to delete all entries in the table, it's faster than using gliderecord&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #232323; font-family: proxima-nova; font-size: 16px;"&gt;gs.sql('truncate &amp;lt;table&amp;gt;');&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #232323; font-family: proxima-nova; font-size: 16px;"&gt;source:&lt;A href="http://www.servicenowelite.com/blog/2014/2/14/deletion-methods" title="http://www.servicenowelite.com/blog/2014/2/14/deletion-methods"&gt;http://www.servicenowelite.com/blog/2014/2/14/deletion-methods&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Dec 2015 14:32:10 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370944#M27870</guid>
      <dc:creator>VigneshMC</dc:creator>
      <dc:date>2015-12-18T14:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Clear log entry?</title>
      <link>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370945#M27871</link>
      <description>&lt;P&gt;Hi George,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I hope you're doing great!&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Perhaps one small thing to add to the list of great comments you already got is that it is a &lt;STRONG&gt;good idea&lt;/STRONG&gt; to avoid doing any type of &lt;STRONG&gt;gs.log()&lt;/STRONG&gt; on the server side scripts. Unless it's used temporarily for debugging in a development instance, it's better to avoid using &lt;EM&gt;&lt;STRONG&gt;log &lt;/STRONG&gt;messages &lt;/EM&gt;for various reasons like:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; a) ensure an agile troubleshooting process in production with only relevant log information&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; b) avoid any type of performance degradation&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; c) exposing any type of sensitive information&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;There may be few scenarios where it might make sense to keep logs message in production, specially for scenarios where there might be an issue that it can't be reproduced in other environment; still, these should be treated as a temporary measure until the root cause of the problem is understood.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;It's also important to keep in mind that &lt;STRONG&gt;gs.log &lt;/STRONG&gt;statements in the service side script will appear in the ServiceNow &lt;STRONG&gt;ACE &lt;/STRONG&gt;report which audits the best practices applied in an implementation.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Berny&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Dec 2015 14:44:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370945#M27871</guid>
      <dc:creator>bernyalvarado</dc:creator>
      <dc:date>2015-12-18T14:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Clear log entry?</title>
      <link>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370946#M27872</link>
      <description>&lt;P&gt;Keep in mind this is a production instance. Doing a &lt;EM&gt;gs.sql&lt;/EM&gt; in a production instance is way too risky. If it's ever needed, It's better to leave this responsibility to the ServiceNow support team &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_emote jive_macro" data-renderedposition="29_175_16_16" src="https://www.servicenow.com/8.0.1.35b65d4/images/emoticons/happy.png"&gt;&lt;/SPAN&gt;. &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Berny&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Dec 2015 14:49:20 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370946#M27872</guid>
      <dc:creator>bernyalvarado</dc:creator>
      <dc:date>2015-12-18T14:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Clear log entry?</title>
      <link>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370947#M27873</link>
      <description>&lt;P&gt;Thanks a lot Berny. &amp;nbsp; This is actually our non-prod environment, we might just forgo the log cleanning, however it good to know about the best time to use gs.log&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 19 Dec 2015 22:35:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370947#M27873</guid>
      <dc:creator>georgechen</dc:creator>
      <dc:date>2015-12-19T22:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Clear log entry?</title>
      <link>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370948#M27874</link>
      <description>&lt;P&gt;Hi Kalaiarasan,&lt;/P&gt;
&lt;P&gt;Thanks for the solution.&lt;/P&gt;
&lt;P&gt;Actually, I tried by removing 'nobody' role from ACL. But after deleting logs, we can not add 'nobody' role again to that ACL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Simran&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 12:17:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/clear-log-entry/m-p/1370948#M27874</guid>
      <dc:creator>Simran Shidvank</dc:creator>
      <dc:date>2020-05-20T12:17:03Z</dc:date>
    </item>
  </channel>
</rss>

