<?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 How to edit my props and transforms to extract the correct time from my sample DNS log from a Syslog encapsulated message? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-props-and-transforms-to-extract-the-correct-time/m-p/280133#M53621</link>
    <description>&lt;P&gt;I have DNS log format as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;14&amp;gt;May 25 23:59:19 COL02 Windows: {"Level":"4","Channel":"DNS Server","Version":"","Computer":"DC01.ntadmin.local","EventID":"55555","ExecutionThreadID":"","Keywords":"0x80000000000000","ProviderName":"DNS Server","Message":"25/05/2016 11:58:26 PM 0820 PACKET  0000000002F797A0 UDP Snd 172.30.235.30   697d R Q [8385 A DR NXDOMAIN] A      (4)wpad(7)ntadmin(5)local(0)","Opcode":"","TimeCreated":"2016-05-25T13:58:50.000000000Z","EventData":"25/05/2016 11:58:26 PM 0820 PACKET  0000000002F797A0 UDP Snd 172.30.235.30   697d R Q [8385 A DR NXDOMAIN] A      (4)wpad(7)ntadmin(5)local(0)","ExecutionProcessID":"","Task":"0","SecurityUserID":"","EventRecordID":"86253"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I use the following in props.conf and transforms.conf:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[windows]
KV_MODE = JSON
TRANSFORMS-T1_extractJSON = extract-json 
TRANSFORMS-T2_win_sourcetype = win_dns

[windows_dns]
KV_MODE = JSON
REPORT-EventData = extract_EventData
TIME_PREFIX= /"Message":"/
TIME_FORMAT = %d/%m/%y %H:%M:%S
SHOULD_LINEMERGE = false
FIELDALIAS-Win:DNS-aliases = Computer AS dest_ip EventID AS eventid host AS dvc opcode AS vendor_query_type packetid AS transaction_id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[win_dns]
DEST_KEY = MetaData:Sourcetype
REGEX = 55555
FORMAT = sourcetype::windows_dns

CLEAN_KEYS = 0

[extract-json]
SOURCE_KEY = _raw
DEST_KEY = _raw
REGEX = ^([^{]+)(?{.+})$
FORMAT = $2

CLEAN_KEYS = 0

[extract_EventData]
CLEAN_KEYS = 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/136219-capture.jpg" alt="alt text" /&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SOURCE_KEY = EventData
MV_ADD = 0
FORMAT = 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to extract the JSON string to get the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;5/26/16
 1:25:40.000 PM    
 { [-] 
     Channel:  DNS Server 
     Computer:  DC01.ntadmin.local 
     EventData:  25/05/2016 11:58:26 PM 0820 PACKET 0000000002F797A0 UDP Snd 172.30.235.30 697d R Q [8385 A DR NXDOMAIN] A (4)wpad(7)ntadmin(5)local(0)
     EventID:  55555 
     EventRecordID:  86253 
     ExecutionProcessID: 
     ExecutionThreadID: 
     Keywords:  0x80000000000000 
     Level:  4 
     Message:  25/05/2016 11:58:26 PM 0820 PACKET 0000000002F797A0 UDP Snd 172.30.235.30 697d R Q [8385 A DR NXDOMAIN] A (4)wpad(7)ntadmin(5)local(0)
     Opcode: 
     ProviderName:  DNS Server 
     SecurityUserID: 
     Task:  0 
     TimeCreated:  2016-05-26T03:21:09.000000000Z 
     Version: 
 }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As seen from above the the ingested time is different from the syslog message time. I have tried to use TIME_PREFIX etc, but doesn't work as I think the syslog message is being parsed already. The Syslog time is being extracted into the Message_Time as follows:&lt;/P&gt;

&lt;P&gt;Message_Time = 3/06/2016 6:01:55 PM&lt;/P&gt;

&lt;P&gt;How can I get this to be the source of truth time?&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 09:51:09 GMT</pubDate>
    <dc:creator>jonnim</dc:creator>
    <dc:date>2020-09-29T09:51:09Z</dc:date>
    <item>
      <title>How to edit my props and transforms to extract the correct time from my sample DNS log from a Syslog encapsulated message?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-props-and-transforms-to-extract-the-correct-time/m-p/280133#M53621</link>
      <description>&lt;P&gt;I have DNS log format as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;14&amp;gt;May 25 23:59:19 COL02 Windows: {"Level":"4","Channel":"DNS Server","Version":"","Computer":"DC01.ntadmin.local","EventID":"55555","ExecutionThreadID":"","Keywords":"0x80000000000000","ProviderName":"DNS Server","Message":"25/05/2016 11:58:26 PM 0820 PACKET  0000000002F797A0 UDP Snd 172.30.235.30   697d R Q [8385 A DR NXDOMAIN] A      (4)wpad(7)ntadmin(5)local(0)","Opcode":"","TimeCreated":"2016-05-25T13:58:50.000000000Z","EventData":"25/05/2016 11:58:26 PM 0820 PACKET  0000000002F797A0 UDP Snd 172.30.235.30   697d R Q [8385 A DR NXDOMAIN] A      (4)wpad(7)ntadmin(5)local(0)","ExecutionProcessID":"","Task":"0","SecurityUserID":"","EventRecordID":"86253"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I use the following in props.conf and transforms.conf:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[windows]
KV_MODE = JSON
TRANSFORMS-T1_extractJSON = extract-json 
TRANSFORMS-T2_win_sourcetype = win_dns

[windows_dns]
KV_MODE = JSON
REPORT-EventData = extract_EventData
TIME_PREFIX= /"Message":"/
TIME_FORMAT = %d/%m/%y %H:%M:%S
SHOULD_LINEMERGE = false
FIELDALIAS-Win:DNS-aliases = Computer AS dest_ip EventID AS eventid host AS dvc opcode AS vendor_query_type packetid AS transaction_id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[win_dns]
DEST_KEY = MetaData:Sourcetype
REGEX = 55555
FORMAT = sourcetype::windows_dns

CLEAN_KEYS = 0

[extract-json]
SOURCE_KEY = _raw
DEST_KEY = _raw
REGEX = ^([^{]+)(?{.+})$
FORMAT = $2

CLEAN_KEYS = 0

[extract_EventData]
CLEAN_KEYS = 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/136219-capture.jpg" alt="alt text" /&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SOURCE_KEY = EventData
MV_ADD = 0
FORMAT = 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to extract the JSON string to get the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;5/26/16
 1:25:40.000 PM    
 { [-] 
     Channel:  DNS Server 
     Computer:  DC01.ntadmin.local 
     EventData:  25/05/2016 11:58:26 PM 0820 PACKET 0000000002F797A0 UDP Snd 172.30.235.30 697d R Q [8385 A DR NXDOMAIN] A (4)wpad(7)ntadmin(5)local(0)
     EventID:  55555 
     EventRecordID:  86253 
     ExecutionProcessID: 
     ExecutionThreadID: 
     Keywords:  0x80000000000000 
     Level:  4 
     Message:  25/05/2016 11:58:26 PM 0820 PACKET 0000000002F797A0 UDP Snd 172.30.235.30 697d R Q [8385 A DR NXDOMAIN] A (4)wpad(7)ntadmin(5)local(0)
     Opcode: 
     ProviderName:  DNS Server 
     SecurityUserID: 
     Task:  0 
     TimeCreated:  2016-05-26T03:21:09.000000000Z 
     Version: 
 }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As seen from above the the ingested time is different from the syslog message time. I have tried to use TIME_PREFIX etc, but doesn't work as I think the syslog message is being parsed already. The Syslog time is being extracted into the Message_Time as follows:&lt;/P&gt;

&lt;P&gt;Message_Time = 3/06/2016 6:01:55 PM&lt;/P&gt;

&lt;P&gt;How can I get this to be the source of truth time?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:51:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-props-and-transforms-to-extract-the-correct-time/m-p/280133#M53621</guid>
      <dc:creator>jonnim</dc:creator>
      <dc:date>2020-09-29T09:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my props and transforms to extract the correct time from my sample DNS log from a Syslog encapsulated message?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-props-and-transforms-to-extract-the-correct-time/m-p/280134#M53622</link>
      <description>&lt;P&gt;Try adding a &lt;CODE&gt;MAX_TIMESTAMP_LOOKAHEAD&lt;/CODE&gt; in your &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/Admin/Propsconf"&gt;props.conf&lt;/A&gt;. Specifies how far (in characters) into an event Splunk should look for a timestamp. In your above exaple, it appears to be around 1100 &lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 12:40:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-props-and-transforms-to-extract-the-correct-time/m-p/280134#M53622</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-06-03T12:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my props and transforms to extract the correct time from my sample DNS log from a Syslog encapsulated message?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-props-and-transforms-to-extract-the-correct-time/m-p/280135#M53623</link>
      <description>&lt;P&gt;I believe I see three issues here.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Is the TIME_PREFIX is correct?  I do not get a match in the UI when using yours.  Try changing &lt;CODE&gt;/"Message":"/&lt;/CODE&gt; to &lt;CODE&gt;"Message":"&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Your TIME_FORMAT hour setting appears incorrect.  You are using the 24-hour format and not 12-hour as indicated by the trailing 'PM'.&lt;/LI&gt;
&lt;LI&gt;Your TIME_FORMAT year setting appears incorrect.  %y is the 2-digit year, so the %Y variable is needed.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;@sundareshr The &lt;CODE&gt;MAX_TIMESTAMP_LOOKAHEAD&lt;/CODE&gt; starts after the &lt;CODE&gt;TIME_PREFIX&lt;/CODE&gt;if specified and defaults to 150 characters.  Since he specified it and the timestamp immediately follows the prefix, the above should work.&lt;/P&gt;

&lt;P&gt;I hope this helps.&lt;/P&gt;

&lt;P&gt;Example of it working is below.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1442i39CDD22389FC01E1/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Josef&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Fri, 03 Jun 2016 13:40:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-props-and-transforms-to-extract-the-correct-time/m-p/280135#M53623</guid>
      <dc:creator>jkuepker_splunk</dc:creator>
      <dc:date>2016-06-03T13:40:49Z</dc:date>
    </item>
  </channel>
</rss>

