<?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 Timechart by source with only basename of source in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-by-source-with-only-basename-of-source/m-p/108631#M28295</link>
    <description>&lt;P&gt;I have a timechart that plots response time by source:&lt;BR /&gt;
index=myidx duration | timechart avg(duration) by source&lt;/P&gt;

&lt;P&gt;Because the name of the source are long, the legend on the right hand side of the plot takes over half the panel, squishing the chart to the left.  Is there anyway I can do a "basename" of the source path, using just the file name, omitting the directory path?&lt;/P&gt;

&lt;P&gt;I suppose I could assign a specific sourcetype for each file but I'm hoping I can just somehow regex &lt;CODE&gt;basename&lt;/CODE&gt; of source.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jul 2012 05:02:23 GMT</pubDate>
    <dc:creator>wang</dc:creator>
    <dc:date>2012-07-26T05:02:23Z</dc:date>
    <item>
      <title>Timechart by source with only basename of source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-by-source-with-only-basename-of-source/m-p/108631#M28295</link>
      <description>&lt;P&gt;I have a timechart that plots response time by source:&lt;BR /&gt;
index=myidx duration | timechart avg(duration) by source&lt;/P&gt;

&lt;P&gt;Because the name of the source are long, the legend on the right hand side of the plot takes over half the panel, squishing the chart to the left.  Is there anyway I can do a "basename" of the source path, using just the file name, omitting the directory path?&lt;/P&gt;

&lt;P&gt;I suppose I could assign a specific sourcetype for each file but I'm hoping I can just somehow regex &lt;CODE&gt;basename&lt;/CODE&gt; of source.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2012 05:02:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-by-source-with-only-basename-of-source/m-p/108631#M28295</guid>
      <dc:creator>wang</dc:creator>
      <dc:date>2012-07-26T05:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart by source with only basename of source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-by-source-with-only-basename-of-source/m-p/108632#M28296</link>
      <description>&lt;P&gt;Sure, just grab the last portion of the path, write it to another field and then timechart by that instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myidx duration | rex field=source "/(?&amp;lt;source_file&amp;gt;[^/]+)$" | timechart avg(duration) by source_file
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Jul 2012 07:06:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-by-source-with-only-basename-of-source/m-p/108632#M28296</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-07-26T07:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart by source with only basename of source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-by-source-with-only-basename-of-source/m-p/108633#M28297</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myidx duration
| eval source = replace(source,"\\","/")
| eval fileNameParts=split(source, "/")
| eval source = mvindex(fileNameParts,mvcount(fileNameParts)-1)
| timechart avg(duration) by source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This splits the source name into parts, and then assigns the last part to source. I also included the replace statement to flip any Windows-style path separators, so this should work even in a mixed environment.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2012 07:06:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-by-source-with-only-basename-of-source/m-p/108633#M28297</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-07-26T07:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart by source with only basename of source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-by-source-with-only-basename-of-source/m-p/108634#M28298</link>
      <description>&lt;P&gt;Thanks.  The regex works great!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2012 21:10:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-by-source-with-only-basename-of-source/m-p/108634#M28298</guid>
      <dc:creator>wang</dc:creator>
      <dc:date>2012-07-26T21:10:23Z</dc:date>
    </item>
  </channel>
</rss>

