<?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: best way to index automatically and update dashboard with unique file name in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/best-way-to-index-automatically-and-update-dashboard-with-unique/m-p/172660#M10678</link>
    <description>&lt;P&gt;Try with updated query.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Oct 2014 21:56:57 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2014-10-17T21:56:57Z</dc:date>
    <item>
      <title>best way to index automatically and update dashboard with unique file name</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/best-way-to-index-automatically-and-update-dashboard-with-unique/m-p/172657#M10675</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a script that uploads a file named file.log to a folder on my computer (let's say &lt;CODE&gt;C:\Users\Public\Documents\splunk_data&lt;/CODE&gt;). I have managed to extract some fields like CPU_usage or Memory_usage and draw it in a dashboard, using the following string:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="file.log" Total_CPU_Usage=* | timechart span=1h max(Total_CPU_Usage)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That works fine, however now my script will upload a new file.log to this folder and I would like splunk to Index it automatically and also update the dashboard with this new data ONLY. I don't want to see the old data.&lt;/P&gt;

&lt;P&gt;How can I:&lt;BR /&gt;
 - Make sure Splunk indexes automatically this file? It seems it's not indexed using "Continuously index data from a file or directory this Splunk instance can access" to &lt;CODE&gt;"C:\Users\Public\Documents\splunk_data"&lt;/CODE&gt;.&lt;BR /&gt;
 - Make sure the old data is removed from the server, or at least not shown in the dashboard.&lt;/P&gt;

&lt;P&gt;At the moment, I'm renaming any new file into fileX.log and uploading it manually. Then I go to the dashboard and change  the source to fileX.log . I'm sure there is a better way to do that &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:56:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/best-way-to-index-automatically-and-update-dashboard-with-unique/m-p/172657#M10675</guid>
      <dc:creator>Javo222</dc:creator>
      <dc:date>2020-09-28T17:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: best way to index automatically and update dashboard with unique file name</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/best-way-to-index-automatically-and-update-dashboard-with-unique/m-p/172658#M10676</link>
      <description>&lt;P&gt;Assuming you have access to physical server where Splunk resides and both the file and splunk are on same server, do the following:-&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Go the machine where Splunk is installed and go to the local folder of the splunk app where you're creating your dashboard. (it would be something like &lt;CODE&gt;c:\Program Files\Splunk\etc\apps\YourAppName\local&lt;/CODE&gt;.&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Create/update a file name inputs.conf and put following&lt;/P&gt;

&lt;P&gt;[monitor://C:\Users\Public\Documents\splunk_data\file.log]&lt;BR /&gt;
disabled = false&lt;BR /&gt;
followTail = 0&lt;BR /&gt;
sourcetype = YourSourceType&lt;BR /&gt;
index = YourIndex&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Restart your splunk instance. This will enable automatic monitoring on the file &lt;CODE&gt;C:\Users\Public\Documents\splunk_data\file.log&lt;/CODE&gt; and will update all changes to splunk automatically. The same can be done from Splunk Web as well See this (&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.4/Data/UseSplunkWeb" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.4/Data/UseSplunkWeb&lt;/A&gt;)&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Change your dashboard query to this to get the latest indexed file.&lt;/P&gt;

&lt;P&gt;source="file.log" Total_CPU_Usage=*  _indextime=[search source="file.log" | head 1 | eval Date=_indextime | return $Date] | timechart span=1h max(Total_CPU_Usage)&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Updated&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="file.log" Total_CPU_Usage=*  [search  source="file.log" | head 1 | eval Date=_indextime | eval search="_indextime=".Date | table search] | timechart span=1h max(Total_CPU_Usage)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:54:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/best-way-to-index-automatically-and-update-dashboard-with-unique/m-p/172658#M10676</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-28T17:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: best way to index automatically and update dashboard with unique file name</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/best-way-to-index-automatically-and-update-dashboard-with-unique/m-p/172659#M10677</link>
      <description>&lt;P&gt;Yes I have access to the server and the file. I've tried your instructions but the search seems wrong, I can't see what is missing. I get the following error:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;Error in 'search' command: Unable to parse the search: Comparator '=' is missing a term on the right hand side.&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2014 21:42:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/best-way-to-index-automatically-and-update-dashboard-with-unique/m-p/172659#M10677</guid>
      <dc:creator>Javo222</dc:creator>
      <dc:date>2014-10-17T21:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: best way to index automatically and update dashboard with unique file name</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/best-way-to-index-automatically-and-update-dashboard-with-unique/m-p/172660#M10678</link>
      <description>&lt;P&gt;Try with updated query.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2014 21:56:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/best-way-to-index-automatically-and-update-dashboard-with-unique/m-p/172660#M10678</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-10-17T21:56:57Z</dc:date>
    </item>
  </channel>
</rss>

