<form version="1.1">
  <label>UTM  Overview</label>
  <fieldset autoRun="true" submitButton="true">
    <input type="time" searchWhenChanged="true" token="time_token">
      <label></label>
      <default>
        <earliest>-60m@m</earliest>
        <latest>now</latest>
      </default>
    </input>
    <input type="dropdown" token="devname">
      <label>Device</label>
      <choice value="*">ANY</choice>
      <search>
        <query>| `_ftnt_dropdown(log.utm, log.devname)`</query>
        <earliest>$time_token.earliest$</earliest>
        <latest>$time_token.latest$</latest>
      </search>
      <fieldForLabel>field_with_count</fieldForLabel>
      <fieldForValue>field</fieldForValue>
      <prefix>log.devname="</prefix>
      <suffix>"</suffix>
      <default>*</default>
    </input>
    <input type="dropdown" token="vdom" searchWhenChanged="true">
      <label>Virtual Domain</label>
      <choice value="*">ANY</choice>
      <search>
        <query>| `_ftnt_dropdown(log.utm, log.vd)`</query>
        <earliest>$time_token.earliest$</earliest>
        <latest>$time_token.latest$</latest>
      </search>
      <fieldForLabel>field_with_count</fieldForLabel>
      <fieldForValue>field</fieldForValue>
      <prefix>log.vd="</prefix>
      <suffix>"</suffix>
      <default>*</default>
    </input>
    <input type="text" token="srcip">
      <label>Source IP</label>
      <prefix>log.srcip="</prefix>
      <suffix>"</suffix>
      <default>*</default>
    </input>
    <input type="text" token="dstip">
      <label>Destination IP</label>
      <prefix>log.dstip="</prefix>
      <suffix>"</suffix>
      <default>*</default>
    </input>
    <input type="text" token="dstport">
      <label>Destination Port</label>
      <prefix>log.dstport="</prefix>
      <suffix>"</suffix>
      <default>*</default>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>Applications</title>
      <table>
        <search>
          <query>| tstats summariesonly=true count(log.traffic.gapp) AS Sessions, sum(log.sentbyte) AS Sent sum(log.rcvdbyte) AS Received from datamodel="ftnt_fos" where nodename="log.traffic" $devname$ $vdom$ $srcip$ $dstip$ $dstport$ groupby log.traffic.gapp, log.traffic.sappcat | sort -Sessions| rename log.traffic.gapp AS Application, log.traffic.sappcat AS Category</query>
          <earliest>$time_token.earliest$</earliest>
          <latest>$time_token.latest$</latest>
        </search>
        <option name="charting.chart">column</option>
        <option name="charting.axisY2.enabled">undefined</option>
        <option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisNone</option>
        <option name="charting.axisLabelsX.majorLabelStyle.rotation">45</option>
        <option name="charting.axisTitleX.visibility">collapsed</option>
        <option name="charting.axisTitleY.visibility">collapsed</option>
        <option name="charting.axisTitleY2.visibility">visible</option>
        <option name="charting.axisX.scale">linear</option>
        <option name="charting.axisY.scale">linear</option>
        <option name="charting.axisY2.scale">inherit</option>
        <option name="charting.chart.bubbleMaximumSize">50</option>
        <option name="charting.chart.bubbleMinimumSize">10</option>
        <option name="charting.chart.bubbleSizeBy">area</option>
        <option name="charting.chart.nullValueMode">gaps</option>
        <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
        <option name="charting.chart.stackMode">default</option>
        <option name="charting.chart.style">shiny</option>
        <option name="charting.drilldown">all</option>
        <option name="charting.layout.splitSeries">0</option>
        <option name="charting.legend.labelStyle.overflowMode">ellipsisMiddle</option>
        <option name="charting.legend.placement">none</option>
        <option name="wrap">true</option>
        <option name="rowNumbers">false</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">row</option>
        <option name="count">10</option>
        <drilldown>
          <link>
            <![CDATA[
                /app/SplunkAppForFortinet/search?q=| datamodel "ftnt_fos" "traffic" search | search log.traffic.gapp="$click.value$"&earliest=$time_token.earliest$&latest=$time_token.latest$]]>
          </link>
        </drilldown>
      </table>
    </panel>
    <panel>
      <title>Cloud Application</title>
      <table>
        <search>
          <query>| tstats summariesonly=true count(log.traffic.gapp) AS Sessions, sum(log.sentbyte) AS Sent sum(log.rcvdbyte) AS Received from datamodel="ftnt_fos" where nodename="log.traffic" $devname$ $vdom$ $srcip$ $dstip$ $dstport$ (log.traffic.sappcat="Video/Audio" OR log.traffic.sappcat="Storage.Backup"  OR log.traffic.sappcat="Cloud.IT" OR log.traffic.sappcat="Collabroation") groupby log.traffic.gapp, log.traffic.sappcat | sort -Sent| rename log.traffic.gapp AS Application, log.traffic.sappcat AS Category</query>
          <earliest>$time_token.earliest$</earliest>
          <latest>$time_token.latest$</latest>
        </search>
        <option name="charting.chart">column</option>
        <option name="charting.axisY2.enabled">false</option>
        <option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisMiddle</option>
        <option name="charting.axisLabelsX.majorLabelStyle.rotation">45</option>
        <option name="charting.axisTitleX.visibility">collapsed</option>
        <option name="charting.axisTitleY.visibility">collapsed</option>
        <option name="charting.axisTitleY2.visibility">visible</option>
        <option name="charting.axisX.scale">linear</option>
        <option name="charting.axisY.scale">linear</option>
        <option name="charting.axisY2.scale">inherit</option>
        <option name="charting.chart.bubbleMaximumSize">50</option>
        <option name="charting.chart.bubbleMinimumSize">10</option>
        <option name="charting.chart.bubbleSizeBy">area</option>
        <option name="charting.chart.nullValueMode">gaps</option>
        <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
        <option name="charting.chart.stackMode">default</option>
        <option name="charting.chart.style">shiny</option>
        <option name="charting.drilldown">all</option>
        <option name="charting.layout.splitSeries">0</option>
        <option name="charting.legend.labelStyle.overflowMode">ellipsisMiddle</option>
        <option name="charting.legend.placement">none</option>
        <option name="wrap">true</option>
        <option name="rowNumbers">false</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">row</option>
        <option name="count">10</option>
        <drilldown>
          <link>
            <![CDATA[
                /app/SplunkAppForFortinet/search?q=| datamodel "ftnt_fos" "traffic" search | search log.traffic.gapp="$click.value$"&earliest=$time_token.earliest$&latest=$time_token.latest$]]>
          </link>
        </drilldown>
      </table>
    </panel>
  </row>
  <row>
    <panel>
      <title>Web Server Access</title>
      <chart>
        <search>
          <query>| tstats summariesonly=true count FROM datamodel="ftnt_fos" WHERE nodename="log.utm.webfilter"   $devname$ $vdom$  $srcip$    GROUPBY log.utm.webfilter.hostname | sort -count | head 30</query>
          <earliest>$time_token.earliest$</earliest>
          <latest>$time_token.latest$</latest>
        </search>
        <option name="charting.chart">column</option>
        <option name="charting.axisY2.enabled">undefined</option>
        <option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisMiddle</option>
        <option name="charting.axisLabelsX.majorLabelStyle.rotation">45</option>
        <option name="charting.axisTitleX.visibility">collapsed</option>
        <option name="charting.axisTitleY.visibility">collapsed</option>
        <option name="charting.axisTitleY2.visibility">visible</option>
        <option name="charting.axisX.scale">linear</option>
        <option name="charting.axisY.scale">linear</option>
        <option name="charting.axisY2.scale">inherit</option>
        <option name="charting.chart.bubbleMaximumSize">50</option>
        <option name="charting.chart.bubbleMinimumSize">10</option>
        <option name="charting.chart.bubbleSizeBy">area</option>
        <option name="charting.chart.nullValueMode">gaps</option>
        <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
        <option name="charting.chart.stackMode">default</option>
        <option name="charting.chart.style">shiny</option>
        <option name="charting.drilldown">all</option>
        <option name="charting.layout.splitSeries">0</option>
        <option name="charting.legend.labelStyle.overflowMode">ellipsisMiddle</option>
        <option name="charting.legend.placement">none</option>
        <!--        
        <drilldown>
          <link>
            <![CDATA[
                /app/SplunkAppForFortinet/search?q=`fortigate_webfilter` hostname="$click.value$"&earliest=$earliest$&latest=$latest$
              ]]>
          </link>
        </drilldown>
-->
        <drilldown>
          <link>
            <![CDATA[
                /app/SplunkAppForFortinet/search?q=| datamodel "ftnt_fos" "webfilter" search | search log.utm.webfilter.hostname="$click.value$"&earliest=$time_token.earliest$&latest=$time_token.latest$]]>
          </link>
        </drilldown>
      </chart>
    </panel>
  </row>
  <row>
    <panel>
      <title>Web Server Access By User</title>
      <chart>
        <search>
          <query>| tstats summariesonly=true count FROM datamodel="ftnt_fos" WHERE nodename="log.utm.webfilter"   log.user!="" $devname$ $vdom$ $srcip$ $dstip$ $dstport$   GROUPBY log.suser | sort -count | head 30</query>
          <earliest>$time_token.earliest$</earliest>
          <latest>$time_token.latest$</latest>
        </search>
        <option name="charting.chart">column</option>
        <option name="charting.axisY2.enabled">undefined</option>
        <option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisMiddle</option>
        <option name="charting.axisLabelsX.majorLabelStyle.rotation">45</option>
        <option name="charting.axisTitleX.visibility">collapsed</option>
        <option name="charting.axisTitleY.visibility">collapsed</option>
        <option name="charting.axisTitleY2.visibility">visible</option>
        <option name="charting.axisX.scale">linear</option>
        <option name="charting.axisY.scale">linear</option>
        <option name="charting.axisY2.scale">inherit</option>
        <option name="charting.chart.bubbleMaximumSize">50</option>
        <option name="charting.chart.bubbleMinimumSize">10</option>
        <option name="charting.chart.bubbleSizeBy">area</option>
        <option name="charting.chart.nullValueMode">gaps</option>
        <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
        <option name="charting.chart.stackMode">default</option>
        <option name="charting.chart.style">shiny</option>
        <option name="charting.drilldown">all</option>
        <option name="charting.layout.splitSeries">0</option>
        <option name="charting.legend.labelStyle.overflowMode">ellipsisMiddle</option>
        <option name="charting.legend.placement">none</option>
        <drilldown>
          <link>
            <![CDATA[
                /app/SplunkAppForFortinet/search?q=`fortigate_webfilter` user="$click.value$"&earliest=$time_token.earliest$&latest=$time_token.latest$
              ]]>
          </link>
        </drilldown>
      </chart>
    </panel>
    <panel>
      <title>Attacks</title>
      <chart>
        <search>
          <query>| tstats summariesonly=true count  FROM datamodel="ftnt_fos" WHERE nodename="log.utm.ips"  GROUPBY log.utm.ips.attack | sort -count | head 30</query>
          <earliest>$time_token.earliest$</earliest>
          <latest>$time_token.latest$</latest>
        </search>
        <option name="charting.chart">column</option>
        <option name="charting.axisY2.enabled">false</option>
        <option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisMiddle</option>
        <option name="charting.axisLabelsX.majorLabelStyle.rotation">45</option>
        <option name="charting.axisTitleX.visibility">collapsed</option>
        <option name="charting.axisTitleY.visibility">collapsed</option>
        <option name="charting.axisTitleY2.visibility">visible</option>
        <option name="charting.axisX.scale">linear</option>
        <option name="charting.axisY.scale">linear</option>
        <option name="charting.axisY2.scale">inherit</option>
        <option name="charting.chart.bubbleMaximumSize">50</option>
        <option name="charting.chart.bubbleMinimumSize">10</option>
        <option name="charting.chart.bubbleSizeBy">area</option>
        <option name="charting.chart.nullValueMode">gaps</option>
        <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
        <option name="charting.chart.stackMode">default</option>
        <option name="charting.chart.style">shiny</option>
        <option name="charting.drilldown">all</option>
        <option name="charting.layout.splitSeries">0</option>
        <option name="charting.legend.labelStyle.overflowMode">ellipsisMiddle</option>
        <option name="charting.legend.placement">none</option>
        <drilldown>
          <link>
            <![CDATA[
                /app/SplunkAppForFortinet/search?q=`fortigate_ips` attack="$click.value$"&earliest=$time_token.earliest$&latest=$time_token.latest$
              ]]>
          </link>
        </drilldown>
      </chart>
    </panel>
  </row>
</form>
