<?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 to ask Splunk to index a file using the CLI? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-ask-Splunk-to-index-a-file-using-the-CLI/m-p/52460#M10104</link>
    <description>&lt;P&gt;If you intend to index the file instead of having Splunk monitoring/tailing it, then I think the CLI "oneshot" command is indeed the best solution.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# splunk add oneshot &amp;lt;path_to_your_file&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You could also create a new monitor input for that file from the CLI, this will index your file but it won't be at all the same than "uploading" it to Splunk as a one-time thing, as Splunk will be keeping track of it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# splunk add monitor &amp;lt;path_to_your_file&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Another possibility is to toss the file in $SPLUNK_HOME/var/spool/splunk which is set up by default as a batch input (see $SPLUNK_HOME/etc/system/default/inputs.conf). Note that the file will be indexed destructively, so you may want to copy it there, not move it.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Sep 2010 02:07:10 GMT</pubDate>
    <dc:creator>hexx</dc:creator>
    <dc:date>2010-09-17T02:07:10Z</dc:date>
    <item>
      <title>How to ask Splunk to index a file using the CLI?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-ask-Splunk-to-index-a-file-using-the-CLI/m-p/52459#M10103</link>
      <description>&lt;P&gt;Other than the oneshot... how would one toss a file into an index through the CLI?&lt;/P&gt;

&lt;P&gt;I likely missed it in the documentation, but i couldn't find it.&lt;/P&gt;

&lt;P&gt;Is there a rest endpoint to do the same?&lt;/P&gt;

&lt;P&gt;maybe oneshot is the only solution to that?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2010 00:42:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-ask-Splunk-to-index-a-file-using-the-CLI/m-p/52459#M10103</guid>
      <dc:creator>hiddenkirby</dc:creator>
      <dc:date>2010-09-17T00:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to ask Splunk to index a file using the CLI?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-ask-Splunk-to-index-a-file-using-the-CLI/m-p/52460#M10104</link>
      <description>&lt;P&gt;If you intend to index the file instead of having Splunk monitoring/tailing it, then I think the CLI "oneshot" command is indeed the best solution.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# splunk add oneshot &amp;lt;path_to_your_file&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You could also create a new monitor input for that file from the CLI, this will index your file but it won't be at all the same than "uploading" it to Splunk as a one-time thing, as Splunk will be keeping track of it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# splunk add monitor &amp;lt;path_to_your_file&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Another possibility is to toss the file in $SPLUNK_HOME/var/spool/splunk which is set up by default as a batch input (see $SPLUNK_HOME/etc/system/default/inputs.conf). Note that the file will be indexed destructively, so you may want to copy it there, not move it.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2010 02:07:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-ask-Splunk-to-index-a-file-using-the-CLI/m-p/52460#M10104</guid>
      <dc:creator>hexx</dc:creator>
      <dc:date>2010-09-17T02:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to ask Splunk to index a file using the CLI?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-ask-Splunk-to-index-a-file-using-the-CLI/m-p/52461#M10105</link>
      <description>&lt;P&gt;Hiddenkirby,
&lt;BR /&gt;You can also use the built-in sinkhole "$SPLUNK_HOME/var/spool/splunk" to index a file in an ad-hoc fashion.  Place any applicable file in there and it will be indexed by Splunk.  Historically you could not control how those files were indexed, but now you can.&lt;/P&gt;

&lt;P&gt;Just add an extra line to the top of your file that looks something like this:&lt;/P&gt;

&lt;PRE&gt;***SPLUNK*** sourcetype=YourSourcetype index=YourIndex host=foo1 ...&lt;/PRE&gt;

&lt;P&gt;And Splunk will index your file with those parameters.&lt;/P&gt;

&lt;P&gt;Read more about it in the Splunk docs:
&lt;A href="http://www.splunk.com/base/Documentation/4.1.5/Admin/Assignmetadatatoeventsdynamically" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/4.1.5/Admin/Assignmetadatatoeventsdynamically&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I use the built-in sinkhole when I am doing a quick test of a new log-type to evaluate it before setting up a perm monitor or when doing an investigation and I need to get a bunch of evidence into Splunk from a system that wasn't already monitored by Splunk.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2010 17:56:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-ask-Splunk-to-index-a-file-using-the-CLI/m-p/52461#M10105</guid>
      <dc:creator>sdwilkerson</dc:creator>
      <dc:date>2010-10-06T17:56:02Z</dc:date>
    </item>
  </channel>
</rss>

