<?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: Timestamps for two different field in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Timestamps-for-two-different-field/m-p/55174#M10754</link>
    <description>&lt;P&gt;I just realized that the rex field got screwed up in formatting.  I fixed it above by adding a \ where appropriate.&lt;BR /&gt;
I don't know how the points work to be honest &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Sep 2013 13:04:20 GMT</pubDate>
    <dc:creator>tincupchalice</dc:creator>
    <dc:date>2013-09-09T13:04:20Z</dc:date>
    <item>
      <title>Timestamps for two different field</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timestamps-for-two-different-field/m-p/55171#M10751</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
  I met one log file that have two timestamps on different field.&lt;BR /&gt;
The first one is the exported time by program on the first line. However, it's not the real time of the syslog. The second one  will be in each line of the syslog but only have the hour time without year,month and day. For the following sample log. Supposedly I want to have the timestamps format like 20130901 15-3-0-126 , any way to do this? Please advise. Thank you very much! &lt;/P&gt;

&lt;H3&gt;FILE&lt;/H3&gt;

&lt;P&gt;Input file=/home/f65351/EBM/A20130901.1600+0800-20130901.1615+0800_10_ebs.1158&lt;BR /&gt;
header|l_header|activation_type|apn|attach_type|bearers|cause_code|cause_prot_type|ci|combined_tau_type|cs_fallback_service_type|deactivation_trigger|deconnect_pdn_type|default_bearer_id|detach_trigger|detach_type|dropped_pdp|duration|eci|ggsn|handover_node_role|handover_rat_change_type&lt;/P&gt;

&lt;P&gt;|service_request-success-15-3-0-126-196|||||#0(nocausecode)|ril3_cause|||||||||||||||||||||||||466-01-9772-1-0-32482|||466015122237199-3962050817-0124210040450917-886938657363||||||||||||0||||466015122237199-3962050817-0124210040450917-8869386573635-211.77.228.233-114.140.116.65-undefined|||wcdma|0||ms||data|||#0(bearer successful)|||||||&lt;/P&gt;

&lt;P&gt;|service_request-success-15-3-0-137-140|||||#0(nocausecode)|ril3_cause|||||||||||||||||||||||||466-01-9113-1-0-25658|||466015801456696-4280957185-3556660525560234-886989688406||||||||||||0||||466015801456696-4280957185-3556660525560234-8869896884065-211.77.232.34-110.26.113.23-undefined|||wcdma|0||ms||data|||#0(bearer  successful)|||||||&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:42:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timestamps-for-two-different-field/m-p/55171#M10751</guid>
      <dc:creator>johnwyane</dc:creator>
      <dc:date>2020-09-28T14:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamps for two different field</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timestamps-for-two-different-field/m-p/55172#M10752</link>
      <description>&lt;P&gt;I did not see the date in the event, just the source file so to answer this I used the following...&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
*&lt;BR /&gt;
| eval file="/home/f65351/EBM/A20130901.1600+0800-20130901.1615+0800_10_ebs.1158"&lt;BR /&gt;
| eval fname=mvindex(split(file, "/"), -1)&lt;BR /&gt;
| eval date=substr(mvindex(split(fname, "."), 0),2)&lt;BR /&gt;
| eval blah="|service_request-success-15-3-0-137-140|||||#0(nocausecode)|ril3_cause|||||||||||||||||||||||||466-01-9113-1-0-25658|||466015801456696-4280957185-3556660525560234-886989688406||||||||||||0||||466015801456696-4280957185-3556660525560234-8869896884065-211.77.232.34-110.26.113.23-undefined|||wcdma|0||ms||data|||#0(bearer  successful)|||||||"&lt;BR /&gt;
| rex field=blah "service_request\-success\-(?&lt;HOUR&gt;\d{1,2})\-(?&lt;MIN&gt;\d{1,2})\-(?&lt;SEC&gt;\d{1,2})\-(?&lt;MSEC&gt;\d{1,3})\-(?&lt;USEC&gt;\d{1,3})"&lt;BR /&gt;
| eval ts=date . " " . hour . "-" . min . "-" . sec . "-" . msec&lt;BR /&gt;
| eval uts = ts . usec&lt;BR /&gt;
| eval numts=strptime(uts, "%Y%m%d %H-%M-%S-%f")&lt;BR /&gt;
| eval sqlts=strftime(numts, "%Y-%m-%d %H:%M:%S.%f")&lt;BR /&gt;
| stats count by date hour min sec msec usec ts uts numts sqlts&lt;BR /&gt;
&lt;/USEC&gt;&lt;/MSEC&gt;&lt;/SEC&gt;&lt;/MIN&gt;&lt;/HOUR&gt;&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;Now you will replace file with source and blah with _raw.&lt;BR /&gt;ts I believe answers your question.&lt;BR /&gt;uts adds what I think is the extra microseconds.&lt;BR /&gt;numts gives you an epoch number for that exact time.&lt;BR /&gt;sqlts is how you can now use that number for other types of applications (like sql).&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:42:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timestamps-for-two-different-field/m-p/55172#M10752</guid>
      <dc:creator>tincupchalice</dc:creator>
      <dc:date>2020-09-28T14:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamps for two different field</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timestamps-for-two-different-field/m-p/55173#M10753</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
   This is a magnificent answer. I spent lots of time to study it. However,everything is work find until rex field . So I didn't get the final answer since I don't have any ideas to modify your answer. But still many thanks.&lt;/P&gt;

&lt;P&gt;Also,Point is from 1 to 10 ??&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2013 06:46:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timestamps-for-two-different-field/m-p/55173#M10753</guid>
      <dc:creator>johnwyane</dc:creator>
      <dc:date>2013-09-09T06:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamps for two different field</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Timestamps-for-two-different-field/m-p/55174#M10754</link>
      <description>&lt;P&gt;I just realized that the rex field got screwed up in formatting.  I fixed it above by adding a \ where appropriate.&lt;BR /&gt;
I don't know how the points work to be honest &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2013 13:04:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Timestamps-for-two-different-field/m-p/55174#M10754</guid>
      <dc:creator>tincupchalice</dc:creator>
      <dc:date>2013-09-09T13:04:20Z</dc:date>
    </item>
  </channel>
</rss>

