<?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: Is it possible to create a timechart from a time field in a CSV or lookup? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225255#M66429</link>
    <description>&lt;P&gt;You all are awesome.&lt;BR /&gt;
The creation of _time via strptime worked perfectly&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Wed, 11 Nov 2015 22:56:20 GMT</pubDate>
    <dc:creator>pkeller</dc:creator>
    <dc:date>2015-11-11T22:56:20Z</dc:date>
    <item>
      <title>Is it possible to create a timechart from a time field in a CSV or lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225250#M66424</link>
      <description>&lt;P&gt;host,value,timestamp&lt;BR /&gt;
a1,30,24-Oct-15 00:00&lt;BR /&gt;
a1,10,24-Oct-15 01:00&lt;BR /&gt;
a1,5,24-Oct-15 02:00&lt;BR /&gt;
a2,3,24-Oct-15 00:00&lt;BR /&gt;
a2,5,24-Oct-15 01:00&lt;/P&gt;

&lt;P&gt;I'm wondering if it's possible using either &lt;CODE&gt;inputcsv&lt;/CODE&gt; or &lt;CODE&gt;inputlookup&lt;/CODE&gt; (if the csv is a lookup table) to do something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputcsv mycsv | search host=a1 | timechart span=1h avg(value) by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(obviously, that doesn't work ... and I'm thinking that the only way to do this is to index the CSV with the TIME_FORMAT defined based on the 'timestamp' field.)&lt;/P&gt;

&lt;P&gt;I probably shouldn't even be asking this to begin with &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 22:23:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225250#M66424</guid>
      <dc:creator>pkeller</dc:creator>
      <dc:date>2015-11-11T22:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to create a timechart from a time field in a CSV or lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225251#M66425</link>
      <description>&lt;P&gt;oh yeah. definitely.&lt;/P&gt;

&lt;P&gt;You'll use &lt;CODE&gt;inputlookup&lt;/CODE&gt; to get csv files loaded. Here is a &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.6/PivotTutorial/AddlookupfilestoSplunk"&gt;doc&lt;/A&gt; on doing that. However, you'll need to turn the timestamp into a timestamp with &lt;CODE&gt;eval&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval _time = strptime(timestamp, "%d-%b-%y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then, you can go ahead and just do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart span=1h max(value) as max_value by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the total search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup data.csv
| eval _time = strptime(timestamp, "%d-%b-%y")
| timechart span=1h max(value) as max_value by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Nov 2015 22:40:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225251#M66425</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-11-11T22:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to create a timechart from a time field in a CSV or lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225252#M66426</link>
      <description>&lt;P&gt;True. Since the &lt;STRONG&gt;timechart&lt;/STRONG&gt; command  uses the &lt;STRONG&gt;_time&lt;/STRONG&gt; field in your event data, that search query will not work, unless you have an &lt;STRONG&gt;_time&lt;/STRONG&gt; field in your csv file.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 22:43:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225252#M66426</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-11-11T22:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to create a timechart from a time field in a CSV or lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225253#M66427</link>
      <description>&lt;P&gt;Hi pkeller,&lt;/P&gt;

&lt;P&gt;yes, you can use &lt;CODE&gt;eval strptime()&lt;/CODE&gt; on the &lt;CODE&gt;timestamp&lt;/CODE&gt; field to parse the value as timestamp, see docs &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.0/SearchReference/Timechart"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.0/SearchReference/Timechart&lt;/A&gt; for more details. So try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |inputcsv mycsv | search host=a1 | eval _time=strptime(timestamp, "%d-%b-%y %H:%M")  | timechart span=1h avg(value) by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 22:45:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225253#M66427</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-11-11T22:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to create a timechart from a time field in a CSV or lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225254#M66428</link>
      <description>&lt;P&gt;do slow today &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 22:46:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225254#M66428</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-11-11T22:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to create a timechart from a time field in a CSV or lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225255#M66429</link>
      <description>&lt;P&gt;You all are awesome.&lt;BR /&gt;
The creation of _time via strptime worked perfectly&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 22:56:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225255#M66429</guid>
      <dc:creator>pkeller</dc:creator>
      <dc:date>2015-11-11T22:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to create a timechart from a time field in a CSV or lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225256#M66430</link>
      <description>&lt;P&gt;I had a similar problem. &lt;/P&gt;</description>
      <pubDate>Sat, 09 Sep 2017 16:12:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-create-a-timechart-from-a-time-field-in-a-CSV/m-p/225256#M66430</guid>
      <dc:creator>sssignals</dc:creator>
      <dc:date>2017-09-09T16:12:20Z</dc:date>
    </item>
  </channel>
</rss>

