All Apps and Add-ons

Splunk welcome.html modifications...

DTERM
Contributor

I've made the following modifications to the welcome.html file in splunk. Basically, I copied a chunk of code from the Sideview application that I'd like modify and use in the welcome.html file. The code I have below is commented fairly well, however it does not work, is it possible to do this? Thanks in advance.

<style>
.welcomediv {
float: left; 
padding-right: 15px;
padding-left: 15px; 
border-right-style: dotted;
border-right-width: 1px;
width: 30%;
}

.intro {
    font-size: 12px;
}

</style>

<div>


<p class="intro">
${_('The Splunk app comes built with some useful out of the inputs, dashboards, custom views, and saved searches. <br/>This app has the following built in functions.')}
</p>
<p>
<strong>${_('Important - all data in the app is by default in its own index named "myapp".')}</strong>

${_('To search for data be sure to include "index=myapp" in your search. ')}<a href="/en-US/app/nc/flashtimeline?q=search%20index%3Dmyapp&earliest=-30d%40d&latest=now"><%doc>TRANS: Link to an example</%doc>${_('example...')}</a>

</p>
<p>
${_('<a href="%s">> Configure Splunk</a>') % make_url('/manager/core')}
</div>

<!--  SIDEVIEW MOD STARTS HERE -->

<div style="float:left; padding-right: 15px; margin-right: 15px; border-right-style: dotted; border-right-width: 1px; width: 30%;">
<h3>${_('This application includes the following comprehensive view templates:')}</h3>
    <ul>
    <li>${_('<a href="%s">Customer 5 Minute Summary</a>') % make_url('/app/myapp/realtime_cusomer_activity')}</li>
    <li>${_('<a href="%s">Customer 1 Hour Summary</a>') % make_url('/app/myapp/customer_activity')}</li>
    </ul>
</div>

<div style="float: left;">

  <module name="HTML" layoutPanel="panel_row1_col1" group="example: static pulldown ">
    <param name="html"><![CDATA[
      Here we start with a single static pulldown element, configure it to output "report" for downstream modules, and then we insert it directly into a $report$ token in a Search module.
      ]]></param>
  </module>

  <module name="Pulldown" layoutPanel="panel_row2_col1" autoRun="True">
    <param name="name">selectedReport</param>
    <param name="label">Show </param>
    <param name="staticFieldsToDisplay">
      <list>
        <param name="label">Average eps</param>
        <param name="value">avg(eps)</param>
      </list>
      <list>
        <param name="label">min, max and average</param>
        <param name="value">min(eps) avg(eps) max(eps)</param>
      </list>
    </param>

    <module name="Search">
      <param name="search">index=myapp source="*metrics.log" group="per_sourcetype_thruput" | stats $selectedReport$ by series</param>
      <param name="earliest">-1h</param>
      <param name="latest">now</param>

      <module name="Pager">
        <param name="entityName">results</param>
        <module name="SimpleResultsTable">
          <param name="displayRowNumbers">False</param>
          <param name="entityName">results</param>
        </module>
      </module>

      <module name="HTML">
        <param name="html"><![CDATA[
          the report is: <b>$selectedReport$</b><br>
          the report label is: <b>$selectedReport.label$</b><br>
          the entire search is: <b>$search$</b>
        ]]></param>
      </module>

    </module>
  </module>

<!---- SIDE VIEW MOD STOPS HERE -->

</div>
1 Solution

sideview
SplunkTrust
SplunkTrust

Splunk wont evaluate the module XML when it renders the HTML. So what this will do is just serve the <module> and <param> tags straight out to the browser.

The HTML part of the include can certainly be included reliably, just not the module XML.

side note: I see you're using Sideview Utils already and you may not know that you can give the HTML module a src param instead of its html param. With src you specify the name of a file in etc/apps/<appname>/appserver/static. See docs).

View solution in original post

0 Karma

sideview
SplunkTrust
SplunkTrust

the treatment for code on answers relies on each line being indented by 4 spaces, or text being enclosed in backticks. If you paste a block of text and it includes linebreaks, it'll generally break the code-formatting, even if you were "within" a code block.

0 Karma

sideview
SplunkTrust
SplunkTrust

Splunk wont evaluate the module XML when it renders the HTML. So what this will do is just serve the <module> and <param> tags straight out to the browser.

The HTML part of the include can certainly be included reliably, just not the module XML.

side note: I see you're using Sideview Utils already and you may not know that you can give the HTML module a src param instead of its html param. With src you specify the name of a file in etc/apps/<appname>/appserver/static. See docs).

0 Karma

DTERM
Contributor

I was expecting to embed a side view "Window" within the Welcome.html file. But nothing shows up afterwards. I don't see the window. Out of curiosity, why does the code appear discombobulated? It was copied into the text block. Thanks.

0 Karma

Ayn
Legend

Please specify how it does not work.

0 Karma
Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

March Community Office Hours Security Series Uncovered!

Hello Splunk Community! In March, Splunk Community Office Hours spotlighted our fabulous Splunk Threat ...

Stay Connected: Your Guide to April Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars in April. This post ...