<?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 can I apply XML DMARC report metadata values to each event in the report? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-apply-XML-DMARC-report-metadata-values-to-each-event/m-p/346395#M22581</link>
    <description>&lt;P&gt;Hi did you make any headway in this issue ? looking to do something similar with DMARC &lt;/P&gt;</description>
    <pubDate>Mon, 21 Aug 2017 14:23:12 GMT</pubDate>
    <dc:creator>Skins</dc:creator>
    <dc:date>2017-08-21T14:23:12Z</dc:date>
    <item>
      <title>How can I apply XML DMARC report metadata values to each event in the report?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-apply-XML-DMARC-report-metadata-values-to-each-event/m-p/346393#M22579</link>
      <description>&lt;P&gt;I'm ingesting XML DMARC reports into Splunk, but the individual events aren't very useful without including things like begin_date, end_date, org_name, email and report_id in each event. Those values only exist in a "metadata" section at the top of the report. How can I take those values that only occur once in the report and include them in each event?&lt;/P&gt;

&lt;P&gt;Here's a sample of the XML data I'm ingesting:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" ?&amp;gt;
&amp;lt;feedback&amp;gt;
  &amp;lt;report_metadata&amp;gt;
    &amp;lt;org_name&amp;gt;emailsrvr.com&amp;lt;/org_name&amp;gt;
    &amp;lt;email&amp;gt;dmarc_reports@emailsrvr.com&amp;lt;/email&amp;gt;
    &amp;lt;extra_contact_info&amp;gt;http://emailsrvr.com&amp;lt;/extra_contact_info&amp;gt;
    &amp;lt;report_id&amp;gt;1a292ea2-d440-4985-a969-839778bceac1&amp;lt;/report_id&amp;gt;
    &amp;lt;date_range&amp;gt;
      &amp;lt;begin&amp;gt;1487289600&amp;lt;/begin&amp;gt;
      &amp;lt;end&amp;gt;1487376000&amp;lt;/end&amp;gt;
    &amp;lt;/date_range&amp;gt;
  &amp;lt;/report_metadata&amp;gt;
  &amp;lt;policy_published&amp;gt;
    &amp;lt;domain&amp;gt;mycompany.com&amp;lt;/domain&amp;gt;
    &amp;lt;adkim&amp;gt;r&amp;lt;/adkim&amp;gt;
    &amp;lt;aspf&amp;gt;r&amp;lt;/aspf&amp;gt;
    &amp;lt;p&amp;gt;none&amp;lt;/p&amp;gt;
    &amp;lt;sp&amp;gt;none&amp;lt;/sp&amp;gt;
    &amp;lt;pct&amp;gt;100&amp;lt;/pct&amp;gt;
  &amp;lt;/policy_published&amp;gt;
  &amp;lt;record&amp;gt;
   &amp;lt;row&amp;gt;
     &amp;lt;source_ip&amp;gt;192.168.x.x&amp;lt;/source_ip&amp;gt;
     &amp;lt;count&amp;gt;1&amp;lt;/count&amp;gt;
     &amp;lt;policy_evaluated&amp;gt;
       &amp;lt;disposition&amp;gt;none&amp;lt;/disposition&amp;gt;
       &amp;lt;dkim&amp;gt;fail&amp;lt;/dkim&amp;gt;
       &amp;lt;spf&amp;gt;pass&amp;lt;/spf&amp;gt;
     &amp;lt;/policy_evaluated&amp;gt;
   &amp;lt;/row&amp;gt;
   &amp;lt;identifiers&amp;gt;
     &amp;lt;header_from&amp;gt;mycompany.com&amp;lt;/header_from&amp;gt;
   &amp;lt;/identifiers&amp;gt;
   &amp;lt;auth_results&amp;gt;
     &amp;lt;spf&amp;gt;
       &amp;lt;domain&amp;gt;mycompany.com&amp;lt;/domain&amp;gt;
       &amp;lt;result&amp;gt;pass&amp;lt;/result&amp;gt;
     &amp;lt;/spf&amp;gt;
   &amp;lt;/auth_results&amp;gt;
  &amp;lt;/record&amp;gt;
  &amp;lt;record&amp;gt;
   &amp;lt;row&amp;gt;
     &amp;lt;source_ip&amp;gt;192.168.x.x&amp;lt;/source_ip&amp;gt;
     &amp;lt;count&amp;gt;1&amp;lt;/count&amp;gt;
     &amp;lt;policy_evaluated&amp;gt;
       &amp;lt;disposition&amp;gt;none&amp;lt;/disposition&amp;gt;
       &amp;lt;dkim&amp;gt;pass&amp;lt;/dkim&amp;gt;
       &amp;lt;spf&amp;gt;fail&amp;lt;/spf&amp;gt;
     &amp;lt;/policy_evaluated&amp;gt;
   &amp;lt;/row&amp;gt;
   &amp;lt;identifiers&amp;gt;
     &amp;lt;header_from&amp;gt;mycompany.com&amp;lt;/header_from&amp;gt;
   &amp;lt;/identifiers&amp;gt;
   &amp;lt;auth_results&amp;gt;
     &amp;lt;spf&amp;gt;
       &amp;lt;domain&amp;gt;mycompany.com&amp;lt;/domain&amp;gt;
       &amp;lt;result&amp;gt;temperror&amp;lt;/result&amp;gt;
     &amp;lt;/spf&amp;gt;
   &amp;lt;/auth_results&amp;gt;
  &amp;lt;/record&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I haven't been able to figure out how to pull the date and org_name fields out of the report_metadata section and put them into into each individual  event. So ideally, I'd like my events to look something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  report_id=1a292ea2-d440-4985-a969-839778bceac1, date_begin=1487289600, date_end=1487376000, org_name=emailsrvr.com, source_ip=192.168.x.x, disposition=none, dkim=fail, spf=pass, header_from=mycompany.com
  report_id=1a292ea2-d440-4985-a969-839778bceac1, date_begin=1487289600, date_end=1487376000, org_name=emailsrvr.com, source_ip=192.168.x.x, disposition=none, dkim=pass, spf=fail, header_from=mycompany.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Some questions:&lt;BR /&gt;
1. Should I ingest the whole XML file as a single event and then do the processing at search time, or should I use XML_KV and break events on the  tag?&lt;BR /&gt;
2. How do I parse out the values in the report_metadata field and apply them to each event?&lt;/P&gt;

&lt;P&gt;Here's my current sourcetype configuration for this data source:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[dmarc_xml]
DATETIME_CONFIG =
LINE_BREAKER = (&amp;lt;record&amp;gt;)
NO_BINARY_CHECK = true
SHOULD_LINEMERGE = true
TIME_FORMAT = %s
TIME_PREFIX = &amp;lt;end&amp;gt;
category = Email
description = DMARC XML Reports
disabled = false
pulldown_type = true
BREAK_ONLY_BEFORE = (&amp;lt;record&amp;gt;)
KV_MODE = xml
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:48:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-apply-XML-DMARC-report-metadata-values-to-each-event/m-p/346393#M22579</guid>
      <dc:creator>lindbergtr</dc:creator>
      <dc:date>2020-09-29T13:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I apply XML DMARC report metadata values to each event in the report?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-apply-XML-DMARC-report-metadata-values-to-each-event/m-p/346394#M22580</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Not a Splunk solution, but perhaps one of these scripts might help:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://github.com/hegga/dmarc-parsing-scripts"&gt;https://github.com/hegga/dmarc-parsing-scripts&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://github.com/prbinu/dmarc-report-processor"&gt;https://github.com/prbinu/dmarc-report-processor&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Sat, 03 Jun 2017 11:20:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-apply-XML-DMARC-report-metadata-values-to-each-event/m-p/346394#M22580</guid>
      <dc:creator>hegga</dc:creator>
      <dc:date>2017-06-03T11:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can I apply XML DMARC report metadata values to each event in the report?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-apply-XML-DMARC-report-metadata-values-to-each-event/m-p/346395#M22581</link>
      <description>&lt;P&gt;Hi did you make any headway in this issue ? looking to do something similar with DMARC &lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2017 14:23:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-apply-XML-DMARC-report-metadata-values-to-each-event/m-p/346395#M22581</guid>
      <dc:creator>Skins</dc:creator>
      <dc:date>2017-08-21T14:23:12Z</dc:date>
    </item>
  </channel>
</rss>

