<?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 store timestamp in KVSTORE in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201977#M39968</link>
    <description>&lt;P&gt;If you want to enforce the field, you can use Fields section in KV store &lt;/P&gt;

&lt;P&gt;Doc : &lt;A href="http://dev.splunk.com/view/webframework-developapps/SP-CAAAEZK"&gt;http://dev.splunk.com/view/webframework-developapps/SP-CAAAEZK&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Details about "how to configure" is available here &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ConfigureKVstorelookups"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ConfigureKVstorelookups&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/webframework-developapps/SP-CAAAEZH"&gt;http://dev.splunk.com/view/webframework-developapps/SP-CAAAEZH&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/webframework-developapps/SP-CAAAEY7"&gt;http://dev.splunk.com/view/webframework-developapps/SP-CAAAEY7&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Programmatically &lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/webframework-tutorials/SP-CAAAEZV"&gt;http://dev.splunk.com/view/webframework-tutorials/SP-CAAAEZV&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Dec 2015 14:20:09 GMT</pubDate>
    <dc:creator>renjith_nair</dc:creator>
    <dc:date>2015-12-29T14:20:09Z</dc:date>
    <item>
      <title>How to store timestamp in KVSTORE</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201976#M39967</link>
      <description>&lt;P&gt;Hi guys &lt;/P&gt;

&lt;P&gt;I have a search manager to retrieve timestamp in EPOCH.&lt;BR /&gt;
However I want a way to be able to store the results in a KVSTORE.&lt;/P&gt;

&lt;P&gt;any ideas ??&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/// Create Search manger to get current timestamp EPOCH TIME 
        var timestamp_search = new SearchManager({
            "id": "timestamp_search",
            "status_buckets": 0,
            "latest_time": "$latest$",
            "search": "| stats count as timestamp | eval timestamp = now()",
            "earliest_time": "$earliest$",
            "cancelOnUnload": true,
            "app": utils.getCurrentApp(),
            "auto_cancel": 90,
            "preview": true,
            "runWhenTimeIsUndefined": false
        }, {tokens: true});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Dec 2015 09:52:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201976#M39967</guid>
      <dc:creator>samaikins</dc:creator>
      <dc:date>2015-12-29T09:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to store timestamp in KVSTORE</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201977#M39968</link>
      <description>&lt;P&gt;If you want to enforce the field, you can use Fields section in KV store &lt;/P&gt;

&lt;P&gt;Doc : &lt;A href="http://dev.splunk.com/view/webframework-developapps/SP-CAAAEZK"&gt;http://dev.splunk.com/view/webframework-developapps/SP-CAAAEZK&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Details about "how to configure" is available here &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ConfigureKVstorelookups"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ConfigureKVstorelookups&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/webframework-developapps/SP-CAAAEZH"&gt;http://dev.splunk.com/view/webframework-developapps/SP-CAAAEZH&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/webframework-developapps/SP-CAAAEY7"&gt;http://dev.splunk.com/view/webframework-developapps/SP-CAAAEY7&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Programmatically &lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/webframework-tutorials/SP-CAAAEZV"&gt;http://dev.splunk.com/view/webframework-tutorials/SP-CAAAEZV&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2015 14:20:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201977#M39968</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2015-12-29T14:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to store timestamp in KVSTORE</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201978#M39969</link>
      <description>&lt;P&gt;thanks renjith for the response,however answer you gave i already. &lt;BR /&gt;
my problem is actually retrieving the search results and saving it into the KVStore&lt;BR /&gt;
In other words i want a timestamp to be automatically generated and stored in the KVStore each time a record is inserted.&lt;BR /&gt;
So the logic i could come up with is to get the timestamp using the search manager and save the results.&lt;BR /&gt;
I am able to get the timestamp from the search manager .&lt;BR /&gt;
However i dont know how to extract the results and save it in the KVstore.&lt;BR /&gt;
Any suggestions&lt;/P&gt;

&lt;P&gt;Thanks &lt;BR /&gt;
Sam&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 01:14:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201978#M39969</guid>
      <dc:creator>samaikins</dc:creator>
      <dc:date>2015-12-30T01:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to store timestamp in KVSTORE</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201979#M39970</link>
      <description>&lt;P&gt;Just assign current timestamp to a variable using eval and add to your original search string (eval time=now()).&lt;/P&gt;

&lt;P&gt;Share your original search string which is used to insert other values into KV Store, we can modify it for you&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 03:05:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201979#M39970</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2015-12-30T03:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to store timestamp in KVSTORE</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201980#M39971</link>
      <description>&lt;P&gt;i created a  search manager object and the search string is&lt;BR /&gt;&lt;BR /&gt;
    &lt;STRONG&gt;"search": "| stats count as timestamp | eval timestamp = now()"&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;so looks like what you suggested.&lt;BR /&gt;
but how do i get the variable "timestamp" into the kvstore.&lt;/P&gt;

&lt;P&gt;my search manager looks like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; /// get current timestamp EPOCH TIME 
        var timestamp_search = new SearchManager({
            "id": "timestamp_search",
            "status_buckets": 0,
            "latest_time": "$latest$",
            "search": "| stats count as timestamp | eval timestamp = now()",
            "earliest_time": "$earliest$",
            "cancelOnUnload": true,
            "app": utils.getCurrentApp(),
            "auto_cancel": 90,
            "preview": true,
            "runWhenTimeIsUndefined": false
        }, {tokens: true});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;my kvstore  dictionary looks like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;            var record = { 
                "time_stamp": timestamp
            }; 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Dec 2015 05:02:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201980#M39971</guid>
      <dc:creator>samaikins</dc:creator>
      <dc:date>2015-12-30T05:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to store timestamp in KVSTORE</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201981#M39972</link>
      <description>&lt;P&gt;You can do it from your search itself using outputlookup&lt;/P&gt;

&lt;P&gt;for eg : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|stats count|eval timestamp=now()|fields timestamp|outputlookup kvstorelookup name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Its already mentioned in the docs provided above. also refer to&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.1511/SearchReference/Outputlookup"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.1511/SearchReference/Outputlookup&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;In general, you can insert a record programmatically using rest end points as well.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/webframework-tutorials/SP-CAAAEZV"&gt;http://dev.splunk.com/view/webframework-tutorials/SP-CAAAEZV&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 05:43:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201981#M39972</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2015-12-30T05:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to store timestamp in KVSTORE</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201982#M39973</link>
      <description>&lt;P&gt;i have some form data that i have to save together with the timestamp.&lt;BR /&gt;
so i can only use the REST API.&lt;BR /&gt;
But i have tried several methods out there but doesnt seem to work .&lt;BR /&gt;
below is the samplecode where i am trying to retrive the timestamp results in to &lt;BR /&gt;
"&lt;STRONG&gt;my_timestamp&lt;/STRONG&gt;" variable where i will inturn save into the dictionary to be used by the REST &lt;BR /&gt;
any ideas &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  /// get current timestamp EPOCH TIME 
        var timestamp_search = new SearchManager({
            "id": "timestamp_search",
            "status_buckets": 0,
            "latest_time": "$latest$",
            "search": "| stats count as timestamp | eval timestamp = now()",
            "earliest_time": "$earliest$",
            "cancelOnUnload": true,
            "app": utils.getCurrentApp(),
            "auto_cancel": 90,
            "preview": true,
            "runWhenTimeIsUndefined": false
        }, {tokens: true,tokenNamespace: "submitted"});


    //WHERE I GET THE TIME STAMP FROM THE SEACH MANAGER 

    var my_timestamp = ??

    //FORM INPUTS
            var record = { 
                "CustID": form_id, 
                "CustName": form_name, 
                "CustStreet": form_street,
                "CustCity": form_city,
                "CustState": form_state,
                "CustZip": form_zip, 
        "time_stamp" : my_timestamp
            }; 

            // Use the request method to send a REST POST request
            // to the storage/collections/data/{collection}/ endpoint
            service.request(
                "storage/collections/data/mycollection/",
                "POST",
                null,
                null,
                JSON.stringify(record),
                {"Content-Type": "application/json"},
                null);
        });
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Dec 2015 08:18:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201982#M39973</guid>
      <dc:creator>samaikins</dc:creator>
      <dc:date>2015-12-31T08:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to store timestamp in KVSTORE</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201983#M39974</link>
      <description>&lt;P&gt;Ok if you are using html, then just get the current time from java script itself instead of creating a search manager just for this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var currentDate=new Date();
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can either use currentDate directly which has full timestamp including timezone or get date/time elements from the date object currentDate according to your requirements.&lt;/P&gt;

&lt;P&gt;Check javascript datetime documents for further reference&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2015 09:30:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201983#M39974</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2015-12-31T09:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to store timestamp in KVSTORE</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201984#M39975</link>
      <description>&lt;P&gt;thanks renjith that did the trick .&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2015 13:27:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201984#M39975</guid>
      <dc:creator>samaikins</dc:creator>
      <dc:date>2015-12-31T13:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to store timestamp in KVSTORE</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201985#M39976</link>
      <description>&lt;P&gt;Glad to here that. Please accept answer so that the question will be closed&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2015 13:44:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-store-timestamp-in-KVSTORE/m-p/201985#M39976</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2015-12-31T13:44:24Z</dc:date>
    </item>
  </channel>
</rss>

