<?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 Re: How do I enable URL links in output in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78284#M4244</link>
    <description>&lt;P&gt;So I used a big hammer to simply copy all the SimpleResultsTable files in $SPLUNKHOME/share/splunk/search_mrsparkle/modules/results to URLResultsTable and then added the following code (stolen from here: &lt;A href="http://stackoverflow.com/questions/1112012/replace-url-with-a-link-using-regex-in-python"&gt;http://stackoverflow.com/questions/1112012/replace-url-with-a-link-using-regex-in-python&lt;/A&gt;)&lt;/P&gt;

&lt;P&gt;import re&lt;/P&gt;

&lt;P&gt;....&lt;/P&gt;

&lt;P&gt;PAT1 = re.compile(r"(^|[\n ])(([\w]+?://[\w#$%&amp;amp;~.-;:=,?@[]+]&lt;EM&gt;)(/[\w#$%&amp;amp;~/.-;:=,?@[]+]&lt;/EM&gt;)?)", re.IGNORECASE | re.DOTALL)&lt;/P&gt;

&lt;P&gt;PAT2 = re.compile(r"#(^|[\n ])(((www|ftp).[\w#$%&amp;amp;~.-;:=,?@[]+]&lt;EM&gt;)(/[\w#$%&amp;amp;~/.-;:=,?@[]+]&lt;/EM&gt;)?)", re.IGNORECASE | re.DOTALL)&lt;/P&gt;

&lt;P&gt;...&lt;/P&gt;

&lt;P&gt;An then right before the return of generateResults()&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    # Convert URLs to links
    output = PAT1.sub(r'\1&amp;lt;a href="\2" target="_blank"&amp;gt;\2&amp;lt;/a&amp;gt;', output)
    output = PAT2.sub(r'\1&amp;lt;a href="http:/\2" target="_blank"&amp;gt;\2&amp;lt;/a&amp;gt;', output)
    return output
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It sounds like this might be easier to do in application.js, but I'm not sure how to filter the entire output stream from there.&lt;/P&gt;</description>
    <pubDate>Sat, 13 Nov 2010 04:28:27 GMT</pubDate>
    <dc:creator>mpatnode</dc:creator>
    <dc:date>2010-11-13T04:28:27Z</dc:date>
    <item>
      <title>How do I enable URL links in output</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78281#M4241</link>
      <description>&lt;P&gt;I have a table in which one column is text which may or may not include a URL.  (Think like a twitter feed).   Is there an easy way to make the URL's clickable or do I need to format the text somehow?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2010 02:19:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78281#M4241</guid>
      <dc:creator>mpatnode</dc:creator>
      <dc:date>2010-10-27T02:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I enable URL links in output</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78282#M4242</link>
      <description>&lt;P&gt;There is no way that I know of to do this with the current table modules.  You would need to super one of the existing table modules or roll your own special module.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2010 05:12:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78282#M4242</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2010-10-27T05:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I enable URL links in output</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78283#M4243</link>
      <description>&lt;P&gt;OK.  I'll bite.  Have a pointer or example of extending one of the existing table modules?   I'm also missing the connection from &lt;TABLE&gt; in my panel XML file and the registered module list: &lt;A href="http://mysplunk:8000/modules"&gt;http://mysplunk:8000/modules&lt;/A&gt;.   It seems a table is made from multiple modules?&lt;P&gt;&lt;/P&gt;&lt;/TABLE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2010 03:28:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78283#M4243</guid>
      <dc:creator>mpatnode</dc:creator>
      <dc:date>2010-11-04T03:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I enable URL links in output</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78284#M4244</link>
      <description>&lt;P&gt;So I used a big hammer to simply copy all the SimpleResultsTable files in $SPLUNKHOME/share/splunk/search_mrsparkle/modules/results to URLResultsTable and then added the following code (stolen from here: &lt;A href="http://stackoverflow.com/questions/1112012/replace-url-with-a-link-using-regex-in-python"&gt;http://stackoverflow.com/questions/1112012/replace-url-with-a-link-using-regex-in-python&lt;/A&gt;)&lt;/P&gt;

&lt;P&gt;import re&lt;/P&gt;

&lt;P&gt;....&lt;/P&gt;

&lt;P&gt;PAT1 = re.compile(r"(^|[\n ])(([\w]+?://[\w#$%&amp;amp;~.-;:=,?@[]+]&lt;EM&gt;)(/[\w#$%&amp;amp;~/.-;:=,?@[]+]&lt;/EM&gt;)?)", re.IGNORECASE | re.DOTALL)&lt;/P&gt;

&lt;P&gt;PAT2 = re.compile(r"#(^|[\n ])(((www|ftp).[\w#$%&amp;amp;~.-;:=,?@[]+]&lt;EM&gt;)(/[\w#$%&amp;amp;~/.-;:=,?@[]+]&lt;/EM&gt;)?)", re.IGNORECASE | re.DOTALL)&lt;/P&gt;

&lt;P&gt;...&lt;/P&gt;

&lt;P&gt;An then right before the return of generateResults()&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    # Convert URLs to links
    output = PAT1.sub(r'\1&amp;lt;a href="\2" target="_blank"&amp;gt;\2&amp;lt;/a&amp;gt;', output)
    output = PAT2.sub(r'\1&amp;lt;a href="http:/\2" target="_blank"&amp;gt;\2&amp;lt;/a&amp;gt;', output)
    return output
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It sounds like this might be easier to do in application.js, but I'm not sure how to filter the entire output stream from there.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2010 04:28:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78284#M4244</guid>
      <dc:creator>mpatnode</dc:creator>
      <dc:date>2010-11-13T04:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I enable URL links in output</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78285#M4245</link>
      <description>&lt;P&gt;Check out the FireEye app on Splunkbase:  &lt;A href="http://splunkbase.splunk.com/apps/All/4.x/App/app:FireEye"&gt;http://splunkbase.splunk.com/apps/All/4.x/App/app:FireEye&lt;/A&gt;.  There are some examples of making table rows clickable using application.js.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2010 06:33:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78285#M4245</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2010-11-13T06:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I enable URL links in output</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78286#M4246</link>
      <description>&lt;P&gt;Note that this becomes quite easy if you use the Sideview Table module instead of the SimpleResultsTable module, and it doesn't require writing a custom module or any custom code at all. &lt;/P&gt;

&lt;P&gt;Say your field was called "url",  and say it was a fully formed URL, including the &lt;CODE&gt;http://&lt;/CODE&gt; and all that. All you would use is the following XML in your view: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;module name="Table"&amp;gt;  
  &amp;lt;module name="HTML" group="row.fields.url"&amp;gt;
    &amp;lt;param name="html"&amp;gt;&amp;lt;![CDATA[
      &amp;lt;a href="$row.fields.url$"&amp;gt;$row.fields.url$&amp;lt;/a&amp;gt;
    ]]&amp;gt;&amp;lt;/param&amp;gt;
  &amp;lt;/module&amp;gt;
&amp;lt;/module&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There are docs about this feature within Sideview Utils itself.  Note that you'll need a relatively recent version of Sideview Utils (currently 2.3) from the Sideview site ( &lt;A href="http://sideviewapps.com/apps/sideview-utils"&gt;http://sideviewapps.com/apps/sideview-utils&lt;/A&gt; ) and not the older version available on Splunkbase. &lt;/P&gt;

&lt;P&gt;Once you get the app installed/upgraded, you can find those docs under "Module Documentation &amp;gt; The Table Module &amp;gt; Table - Embedding Examples".&lt;/P&gt;

&lt;P&gt;To paraphrase the official docs though,  if the Table finds itself with any module immediately downstream that has a group attribute matching "row.fields.someField", and it finds that it actually has a field called "someField" in the results it's rendering,  then instead of rendering ordinary text as the contents of those tablecells,  it will process and render the given module config.   In this case we've given it just a simple HTML module, and as you can see we tell it to render a link in the tablecell instead.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 07:39:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-enable-URL-links-in-output/m-p/78286#M4246</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-01-17T07:39:53Z</dc:date>
    </item>
  </channel>
</rss>

