<?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: Very odd timestamp - how can I extract? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140437#M38806</link>
    <description>&lt;P&gt;Are you saying that you &lt;EM&gt;don't&lt;/EM&gt; have a day of the month (1-31) in the log file?!!&lt;/P&gt;

&lt;P&gt;Also @davebrooking made a good suggestion for a getting a day of the week. In fact, you can even ask Splunk to calculate that for you, giving you either a number or the actual day - for &lt;EM&gt;any&lt;/EM&gt; search. For example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yourseachhere
| eval dow_number = strftime(_time,"%A")
| eval dow_name = strftime(_time,"%u")
| eval timestamp = strftime(_time"%x %X")
| table timestamp dow_name dow_number
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So there is really no reason to worry about the day of week at input time. And the &lt;CODE&gt;dow_number&lt;/CODE&gt; above is 1-7 where Monday=1&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2015 05:41:46 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2015-06-10T05:41:46Z</dc:date>
    <item>
      <title>Very odd timestamp - how can I extract?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140433#M38802</link>
      <description>&lt;P&gt;Hi all - I need to "build" a timestamp from an event. The events are fixed format, meaning timestamp variables will always appear in the same place in each event. However, I am not sure how I can write an extraction to deal with this.&lt;/P&gt;

&lt;P&gt;Here is a sample event (also attached to question to ensure formatting).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  A       201312    13064           34                2                             34105                                            122  2    07  Y2 7                          31  0502 2   073          01  1    2                         09042                      0805  273  Y00000000    N                  NNNNNNN NXXN00    2   222       NN NNNNNNN  2 2  NNNNN NNNYNN 1     2  2       11X    221 1NNNNNN3N22 094885  1            F 03  201339   40082       2722    063  NNNNNNN         NNNNNNNNNNNN22       2    2  2 2  NYY23.32888881730817308140167659           11111111111111111111 1111111 111111111111 111111  1111111111111111111111111111 1   11              1  111111111    1   111            1 1      1     1  1            11                11       1    1  1 1    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The variables that make up the time can be found in the event in the following places:&lt;/P&gt;

&lt;P&gt;position - unit&lt;BR /&gt;
...14    - blank (or not related)&lt;BR /&gt;
15-18  - year&lt;BR /&gt;
19-20 - month (values = 1-12 [1 = jan])&lt;BR /&gt;
21-24 - blank&lt;BR /&gt;
25-28  - time (24hr/min)&lt;BR /&gt;
29 - day (values = 1-7 [1 = sunday])&lt;/P&gt;

&lt;P&gt;So in the above event the time would be: 2013 (2013), December (12), 13h06m (1306), Thursday (4)&lt;/P&gt;

&lt;P&gt;To add some context - this is birth record data. you cannot find the exact day of a month, just the day of the month someone was born.&lt;/P&gt;

&lt;P&gt;I just cannot get a match in my extraction &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; Can anyone provide any guidance towards a nice way to extract this time for Splunk?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2015 20:07:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140433#M38802</guid>
      <dc:creator>himynamesdave</dc:creator>
      <dc:date>2015-06-02T20:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Very odd timestamp - how can I extract?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140434#M38803</link>
      <description>&lt;P&gt;In props.conf, try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TIME_PREFIX=.{14}
TIME_FORMAT=%Y%m       %H%M%d
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jun 2015 20:13:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140434#M38803</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-06-02T20:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Very odd timestamp - how can I extract?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140435#M38804</link>
      <description>&lt;P&gt;Hi Lisa, thanks! Sadly this doesn't work.&lt;/P&gt;

&lt;P&gt;My problem is the "day" field. Instead of %d in your answer I tried %w. However, %w expects 0-6 (0=Sunday). In my events my days count from 1-7 (1=Sunday). Any easy way to fix this?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2015 20:58:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140435#M38804</guid>
      <dc:creator>himynamesdave</dc:creator>
      <dc:date>2015-06-02T20:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Very odd timestamp - how can I extract?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140436#M38805</link>
      <description>&lt;P&gt;Hi Dave&lt;/P&gt;

&lt;P&gt;Could you do as Lisa suggests and use the %d in the time format, and also define a &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/Knowledge/definecalcfields"&gt;calculated field&lt;/A&gt; that would translate your value of 1-7 into the day of the week.&lt;/P&gt;

&lt;P&gt;Add a stanza into props.conf (I don't have an instance of Splunk to test this at the moment) of the form&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Stanza&amp;gt;
Eval-YourField = case(date_mday==1, "Sunday", date_mday==2,"Monday", ...)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jun 2015 06:07:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140436#M38805</guid>
      <dc:creator>davebrooking</dc:creator>
      <dc:date>2015-06-03T06:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Very odd timestamp - how can I extract?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140437#M38806</link>
      <description>&lt;P&gt;Are you saying that you &lt;EM&gt;don't&lt;/EM&gt; have a day of the month (1-31) in the log file?!!&lt;/P&gt;

&lt;P&gt;Also @davebrooking made a good suggestion for a getting a day of the week. In fact, you can even ask Splunk to calculate that for you, giving you either a number or the actual day - for &lt;EM&gt;any&lt;/EM&gt; search. For example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yourseachhere
| eval dow_number = strftime(_time,"%A")
| eval dow_name = strftime(_time,"%u")
| eval timestamp = strftime(_time"%x %X")
| table timestamp dow_name dow_number
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So there is really no reason to worry about the day of week at input time. And the &lt;CODE&gt;dow_number&lt;/CODE&gt; above is 1-7 where Monday=1&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 05:41:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140437#M38806</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-06-10T05:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Very odd timestamp - how can I extract?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140438#M38807</link>
      <description>&lt;P&gt;really odd, i can't get it&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 07:33:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Very-odd-timestamp-how-can-I-extract/m-p/140438#M38807</guid>
      <dc:creator>crystaltransfer</dc:creator>
      <dc:date>2015-06-10T07:33:45Z</dc:date>
    </item>
  </channel>
</rss>

