Splunk Search

splunk replace the content of viz after search query execution completed

AnilPujar
Path Finder

I need to remove the ": 1" in content "CHG0014888 (N): 1"

HTML Content:

<tr>
  <td rowspan="2"></td>
  <td rowspan="2"></td>
  <td rowspan="2"></td>
  <td rowspan="2"></td>
  <td rowspan="2"></td>
  <td class="fc-event-container">
    <a class="fc-day-grid-event fc-h-event fc-event fc-start fc-end" style="background-color:#0e776d;border-color:#0e776d">
      <div class="fc-content"><span class="fc-time">4a</span> <span class="fc-title">CHG0014634 (N): 1</span></div>
    </a>
  </td>
  <td rowspan="2"></td>
</tr>


<tr>
  <td class="fc-event-container">
    <a class="fc-day-grid-event fc-h-event fc-event fc-start fc-end" style="background-color:#e2c188;border-color:#e2c188">
      <div class="fc-content"><span class="fc-time">10a</span> <span class="fc-title">CHG0014888 (N): 1</span></div>
    </a>
  </td>
</tr>

JQuery: which is working in js fiddle but not in splunk

    $('.fc-title').html(
        function (index, oldHtml) {
            return oldHtml.replace(": 1", "");
        }
     );

The below background color change function is working but the above content removal function not working.

   require([
       'underscore',
       'jquery',
       'splunkjs/mvc',
       'splunkjs/mvc/simpleform/formutils',
       'splunkjs/mvc/simplexml/ready!'
       ], function(_, $, mvc, FormUtils) {

    $( document ).bind('DOMSubtreeModified',function() {
            $('span:contains("(S)")').closest('.fc-day-grid-event').addClass('std_chg_type');
            $('span:contains("(N)")').closest('.fc-day-grid-event').addClass('norm_chg_type');
            $('span:contains("(E)")').closest('.fc-day-grid-event').addClass('emerg_chg_type');
     });

     $( document ).ready(function() {
             $('.fc-title').html(
               function (index, oldHtml) {
              return oldHtml.replace(": 1", "");
             });
      });
      });
0 Karma

AnilPujar
Path Finder

The above customization i'm doing in custom calendar visualization.

0 Karma
Get Updates on the Splunk Community!

Observability | How to Think About Instrumentation Overhead (White Paper)

Novice observability practitioners are often overly obsessed with performance. They might approach ...

Cloud Platform | Get Resiliency in the Cloud Event (Register Now!)

IDC Report: Enterprises Gain Higher Efficiency and Resiliency With Migration to Cloud  Today many enterprises ...

The Great Resilience Quest: 10th Leaderboard Update

The tenth leaderboard update (11.23-12.05) for The Great Resilience Quest is out &gt;&gt; As our brave ...