<?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: create new field with REST API of splunk in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423350#M51649</link>
    <description>&lt;P&gt;If you look at the document &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.3/RESTREF/RESTsearch#search.2Fjobs.2Fexport"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.3/RESTREF/RESTsearch#search.2Fjobs.2Fexport&lt;/A&gt; then it is saying that &lt;CODE&gt;search/jobs/export&lt;/CODE&gt; will stream results as they become available, if you want to search the data and then retrieve result once job will complete then use other rest endpoint&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:mypassword &lt;A href="https://localhost:8089/services/search/jobs" target="test_blank"&gt;https://localhost:8089/services/search/jobs&lt;/A&gt; -d search="search source=train.csv |rex field=_raw \"^(?:[^,\n]*,){5}(?P&amp;lt;extracted_field&amp;gt;\w+,)\"| top gen" -d id=mysearch -d earliest_time=-15m@m
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And to retrieve results in another request&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:mypassword &lt;A href="https://localhost:8089/services/search/jobs/mysearch/results" target="test_blank"&gt;https://localhost:8089/services/search/jobs/mysearch/results&lt;/A&gt; --get -d output_mode=json
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 25 Jan 2019 09:47:22 GMT</pubDate>
    <dc:creator>harsmarvania57</dc:creator>
    <dc:date>2019-01-25T09:47:22Z</dc:date>
    <item>
      <title>create new field with REST API of splunk</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423347#M51646</link>
      <description>&lt;P&gt;I am new in splunk... I am trying to create a new field(want to give a name as "gen") from raw events of train.csv (mydataset) by using regular expression of splunk REST api . my same regualar expression is working well in splunk web page but getting parenthesis error .&lt;BR /&gt;
here is my code&lt;BR /&gt;
curl -k -u admin:mypassword &lt;A href="https://localhost:8089/services/search/jobs/export"&gt;https://localhost:8089/services/search/jobs/export&lt;/A&gt; -d search="search source=train.csv |rex field=_raw '^(?:[^,\n]*,){5}(?P\w+,)'| top gen"&lt;/P&gt;

&lt;P&gt;but getting error&lt;BR /&gt;
FATAL"&amp;gt;Error in 'rex' command: Encountered the following error while compiling the regex ''^(?:[^': Regex: missing closing parenthesis&lt;/P&gt;

&lt;P&gt;I have checked no parenthesis missing...please help me to get right code&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 08:13:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423347#M51646</guid>
      <dc:creator>snigdha9nov</dc:creator>
      <dc:date>2019-01-24T08:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: create new field with REST API of splunk</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423348#M51647</link>
      <description>&lt;P&gt;Hi @snigdha9nov,&lt;/P&gt;

&lt;P&gt;You can try below command which works fine and it will extract field called &lt;CODE&gt;extracted_field&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:mypassword &lt;A href="https://localhost:8089/services/search/jobs/export" target="test_blank"&gt;https://localhost:8089/services/search/jobs/export&lt;/A&gt; -d search="search source=train.csv |rex field=_raw \"^(?:[^,\n]*,){5}(?P&amp;lt;extracted_field&amp;gt;\w+,)\"| top gen"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For example I am running below query in my lab to extract IP address from &lt;CODE&gt;_internal&lt;/CODE&gt; index and it is working fine.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -vk -u admin:mypass &lt;A href="https://localhost:8089/services/search/jobs/export" target="test_blank"&gt;https://localhost:8089/services/search/jobs/export&lt;/A&gt; -d search="search index=_internal source=*splunkd.log | rex \"from\s(?&amp;lt;ip&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Jan 2019 09:13:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423348#M51647</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-01-25T09:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: create new field with REST API of splunk</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423349#M51648</link>
      <description>&lt;P&gt;fieldOrder&amp;gt;&lt;/P&gt;

&lt;P&gt;thanks a lot ...but I am unable to see the result&lt;/P&gt;

&lt;P&gt;gen&lt;BR /&gt;
count&lt;BR /&gt;
percent&lt;BR /&gt;
_tc&lt;/P&gt;

&lt;P&gt;Configuration initialization for /Applications/Splunk/etc took 19ms when dispatching a search (search ID: 1548407977.58)&lt;BR /&gt;
  base lispy: [ AND source::train.csv ]&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 09:27:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423349#M51648</guid>
      <dc:creator>snigdha9nov</dc:creator>
      <dc:date>2019-01-25T09:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: create new field with REST API of splunk</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423350#M51649</link>
      <description>&lt;P&gt;If you look at the document &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.3/RESTREF/RESTsearch#search.2Fjobs.2Fexport"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.3/RESTREF/RESTsearch#search.2Fjobs.2Fexport&lt;/A&gt; then it is saying that &lt;CODE&gt;search/jobs/export&lt;/CODE&gt; will stream results as they become available, if you want to search the data and then retrieve result once job will complete then use other rest endpoint&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:mypassword &lt;A href="https://localhost:8089/services/search/jobs" target="test_blank"&gt;https://localhost:8089/services/search/jobs&lt;/A&gt; -d search="search source=train.csv |rex field=_raw \"^(?:[^,\n]*,){5}(?P&amp;lt;extracted_field&amp;gt;\w+,)\"| top gen" -d id=mysearch -d earliest_time=-15m@m
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And to retrieve results in another request&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -k -u admin:mypassword &lt;A href="https://localhost:8089/services/search/jobs/mysearch/results" target="test_blank"&gt;https://localhost:8089/services/search/jobs/mysearch/results&lt;/A&gt; --get -d output_mode=json
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Jan 2019 09:47:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423350#M51649</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-01-25T09:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: create new field with REST API of splunk</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423351#M51650</link>
      <description>&lt;P&gt;curl -k -u admin:password &lt;A href="https://localhost:8089/services/search/jobs/1548409940.125/results"&gt;https://localhost:8089/services/search/jobs/1548409940.125/results&lt;/A&gt; --get -d output_mode=json&lt;/P&gt;

&lt;P&gt;why getting this&lt;BR /&gt;
{"messages":[{"type":"FATAL","text":"Unknown sid."}]}&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 09:56:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423351#M51650</guid>
      <dc:creator>snigdha9nov</dc:creator>
      <dc:date>2019-01-25T09:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: create new field with REST API of splunk</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423352#M51651</link>
      <description>&lt;P&gt;From where you got this SID &lt;CODE&gt;1548409940.125&lt;/CODE&gt; ? If you do not want to rely on Splunk generated SID then you can supply user friendly SID name (&lt;CODE&gt;-d id=mysearch&lt;/CODE&gt;) when firing search, see example I have given above and use that SID to retrieve results.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 09:59:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423352#M51651</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-01-25T09:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: create new field with REST API of splunk</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423353#M51652</link>
      <description>&lt;P&gt;{"preview":false,"init_offset":0,"post_process_count":0,"messages":[],"results":&lt;/P&gt;

&lt;P&gt;I&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:57:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423353#M51652</guid>
      <dc:creator>snigdha9nov</dc:creator>
      <dc:date>2020-09-29T22:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: create new field with REST API of splunk</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423354#M51653</link>
      <description>&lt;P&gt;This means that query didn't find any matching events, please wider your time span.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 10:35:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423354#M51653</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-01-25T10:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: create new field with REST API of splunk</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423355#M51654</link>
      <description>&lt;P&gt;DEBUG"&amp;gt;Configuration initialization for /Applications/Splunk/etc took 19ms when dispatching a search (search ID: 1548416060.239)&lt;BR /&gt;
  base lispy: [ AND source::train.csv ]&lt;/P&gt;

&lt;P&gt;still facing this problem&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 11:43:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/create-new-field-with-REST-API-of-splunk/m-p/423355#M51654</guid>
      <dc:creator>snigdha9nov</dc:creator>
      <dc:date>2019-01-25T11:43:48Z</dc:date>
    </item>
  </channel>
</rss>

