<?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 change ldapsearch that is returning whenCreated attribute in an awkward timestamp format? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-change-ldapsearch-that-is-returning-whenCreated-attribute/m-p/244315#M47262</link>
    <description>&lt;P&gt;REALLY CLOSE!  Close enough to give me the final clue:  Just needed:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval x=strptime(whenCreated, "%Y%m%d%H%M%S") | eval t=strftime(x, "%c")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Tue, 24 Nov 2015 15:03:56 GMT</pubDate>
    <dc:creator>kearaspoor</dc:creator>
    <dc:date>2015-11-24T15:03:56Z</dc:date>
    <item>
      <title>How to change ldapsearch that is returning whenCreated attribute in an awkward timestamp format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-change-ldapsearch-that-is-returning-whenCreated-attribute/m-p/244311#M47258</link>
      <description>&lt;P&gt;I have an ldapsearch that is successfully retrieving multiple AD attributes including the whenCreated attribute.  Unfortunately, this field is coming back in this format:  YYYYMMDDhhmmss.0Z  which I can't seem to get converted into a usable/easily readable format.&lt;/P&gt;

&lt;P&gt;I've tried the following:  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| convert mktime(whenCreated)  - returns a blank field
| convert ctime(whenCreated - returns a blank field
| eval n=round(whenCreated,0)  - does not create the new field "n" as would be expected
| convert num(whenCreated)  - removes the Z leaving YYYYmmddHHMMSS.0
| convert num(whenCreated) | eval n=round(whenCreated,0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;successfully creates new field "n" with the number in YYYYmmddHHMMSS format, leaving off the ".0Z"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| convert num(whenCreated) | eval n=round(whenCreated,0)  | eval CreatedString=tostring(n)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;creates new field "CreatedString" that's a direct copy of "n", assuming in string format.&lt;/P&gt;

&lt;P&gt;BUT!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| convert num(whenCreated) | eval n=round(whenCreated,0)  | eval CreatedString=tostring(n) | eval WHENCREATED=strptime(CreatedString,"%Y/%m/%d %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Does NOT create a new field called "WHENCREATED" as would be expected.&lt;/P&gt;

&lt;P&gt;1) Is is possible to adjust the LDAP query to return the whenCreated attribute in a more human-readable format? (I'm very much an LDAP newbie)&lt;BR /&gt;
2) Why does the last series of convert/eval commands not place the values in the timeformat specified?&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 14:12:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-change-ldapsearch-that-is-returning-whenCreated-attribute/m-p/244311#M47258</guid>
      <dc:creator>kearaspoor</dc:creator>
      <dc:date>2015-11-24T14:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to change ldapsearch that is returning whenCreated attribute in an awkward timestamp format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-change-ldapsearch-that-is-returning-whenCreated-attribute/m-p/244312#M47259</link>
      <description>&lt;P&gt;This should work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval s="20151124092244.0Z" | eval x=strptime(s, "%Y%m%d%H%M%S") | eval t=strftime(x, "%c")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Nov 2015 14:32:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-change-ldapsearch-that-is-returning-whenCreated-attribute/m-p/244312#M47259</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-11-24T14:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to change ldapsearch that is returning whenCreated attribute in an awkward timestamp format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-change-ldapsearch-that-is-returning-whenCreated-attribute/m-p/244313#M47260</link>
      <description>&lt;P&gt;I can't help with LDAP, but this command will parse the whenCreated value in its current form.  The convert commands are unnecessary as strptime does all of the required conversions.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval WHENCREATED=strptime(whenCreated,"%Y%m%d%H%M%S.%1N%Z")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Nov 2015 14:40:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-change-ldapsearch-that-is-returning-whenCreated-attribute/m-p/244313#M47260</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-11-24T14:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to change ldapsearch that is returning whenCreated attribute in an awkward timestamp format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-change-ldapsearch-that-is-returning-whenCreated-attribute/m-p/244314#M47261</link>
      <description>&lt;P&gt;nope.. that just gave me a 10 digit number with 6 decimal points..  Wish it had been that easy!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 14:59:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-change-ldapsearch-that-is-returning-whenCreated-attribute/m-p/244314#M47261</guid>
      <dc:creator>kearaspoor</dc:creator>
      <dc:date>2015-11-24T14:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to change ldapsearch that is returning whenCreated attribute in an awkward timestamp format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-change-ldapsearch-that-is-returning-whenCreated-attribute/m-p/244315#M47262</link>
      <description>&lt;P&gt;REALLY CLOSE!  Close enough to give me the final clue:  Just needed:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval x=strptime(whenCreated, "%Y%m%d%H%M%S") | eval t=strftime(x, "%c")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 15:03:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-change-ldapsearch-that-is-returning-whenCreated-attribute/m-p/244315#M47262</guid>
      <dc:creator>kearaspoor</dc:creator>
      <dc:date>2015-11-24T15:03:56Z</dc:date>
    </item>
  </channel>
</rss>

