<?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: Parsing XML into fields is not working properly in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475310#M31214</link>
    <description>&lt;P&gt;my splunk works, I don't know missing fields and restart,&lt;BR /&gt;
good luck&lt;/P&gt;</description>
    <pubDate>Thu, 19 Mar 2020 08:56:57 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-03-19T08:56:57Z</dc:date>
    <item>
      <title>Parsing XML into fields is not working properly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475301#M31205</link>
      <description>&lt;P&gt;Splunk isn't completely parsing the xml into fields in search results, only sections. For example, in the sample event below, the &lt;CODE&gt;system&lt;/CODE&gt; and &lt;CODE&gt;userdata&lt;/CODE&gt; sections are fields but the xml headers inside them are not parsed into fields (i.e. &lt;CODE&gt;Username&lt;/CODE&gt; and &lt;CODE&gt;IpAddress&lt;/CODE&gt;.)&lt;BR /&gt;
Based on some of what I've read here in the forums, I've already edited my &lt;CODE&gt;props.conf&lt;/CODE&gt; for sourcetype=XmlWinEventLog but haven't seen any change.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source::XmlWinEventLog]
KV_MODE=xml
TRUNCATE = 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't know what I'm missing and could use some help. (Hell, what I put in there, Splunk was probably already doing)&lt;/P&gt;

&lt;P&gt;Here's a sample event (I added line breaks to make it easier to read. Raw data in search results it's a single line):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event" xml:lang="en-US"&amp;gt;
&amp;lt;System&amp;gt;
  &amp;lt;Provider Name="Microsoft-Windows-TerminalServices-Gateway" Guid="{4D5AE6A1-C7C8-4E6D-B840-4D8080B42E1B}" /&amp;gt; 
  &amp;lt;EventID&amp;gt;200&amp;lt;/EventID&amp;gt; 
  &amp;lt;Version&amp;gt;0&amp;lt;/Version&amp;gt; 
  &amp;lt;Level&amp;gt;4&amp;lt;/Level&amp;gt; 
  &amp;lt;Task&amp;gt;2&amp;lt;/Task&amp;gt; 
  &amp;lt;Opcode&amp;gt;30&amp;lt;/Opcode&amp;gt; 
  &amp;lt;Keywords&amp;gt;0x4020000001000000&amp;lt;/Keywords&amp;gt; 
  &amp;lt;TimeCreated SystemTime="2020-02-21T18:54:19.913701800Z" /&amp;gt; 
  &amp;lt;EventRecordID&amp;gt;1219&amp;lt;/EventRecordID&amp;gt; 
  &amp;lt;Correlation ActivityID="{BEA11342-474B-47DE-907D-F2FBEBD40000}" /&amp;gt; 
  &amp;lt;Execution ProcessID="5480" ThreadID="8416" /&amp;gt; 
  &amp;lt;Channel&amp;gt;Microsoft-Windows-TerminalServices-Gateway/Operational&amp;lt;/Channel&amp;gt; 
  &amp;lt;Computer&amp;gt;gatewayserver.domain.com&amp;lt;/Computer&amp;gt; 
  &amp;lt;Security UserID="S-1-5-20" /&amp;gt; 
  &amp;lt;/System&amp;gt;
&amp;lt;UserData&amp;gt;
&amp;lt;EventInfo xmlns="aag"&amp;gt;
  &amp;lt;Username&amp;gt;domain\username&amp;lt;/Username&amp;gt; 
  &amp;lt;IpAddress&amp;gt;173.x.x.x&amp;lt;/IpAddress&amp;gt; 
  &amp;lt;AuthType&amp;gt;NTLM&amp;lt;/AuthType&amp;gt; 
  &amp;lt;Resource /&amp;gt; 
  &amp;lt;ConnectionProtocol&amp;gt;HTTP&amp;lt;/ConnectionProtocol&amp;gt; 
  &amp;lt;ErrorCode&amp;gt;0&amp;lt;/ErrorCode&amp;gt; 
  &amp;lt;/EventInfo&amp;gt;
  &amp;lt;/UserData&amp;gt;
&amp;lt;RenderingInfo Culture="en-US"&amp;gt;
  &amp;lt;Message&amp;gt;The user "domain\username", on client computer "173.x.x.x", met connection authorization policy requirements and was therefore authorized to access the RD Gateway server. The authentication method used was: "NTLM" and connection protocol used: "HTTP".&amp;lt;/Message&amp;gt; 
  &amp;lt;Level&amp;gt;Information&amp;lt;/Level&amp;gt; 
  &amp;lt;Task /&amp;gt; 
  &amp;lt;Opcode /&amp;gt; 
  &amp;lt;Channel /&amp;gt; 
  &amp;lt;Provider /&amp;gt; 
&amp;lt;Keywords&amp;gt;
  &amp;lt;Keyword&amp;gt;Audit Success&amp;lt;/Keyword&amp;gt; 
  &amp;lt;/Keywords&amp;gt;
  &amp;lt;/RenderingInfo&amp;gt;
  &amp;lt;/Event&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Feb 2020 20:21:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475301#M31205</guid>
      <dc:creator>aaronzabell</dc:creator>
      <dc:date>2020-02-21T20:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing XML into fields is not working properly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475302#M31206</link>
      <description>&lt;P&gt;@aaronzabell I tried to feed the sample data you provided to a run anywhere search and spath extracted the fields including User Name and IP address correctly. So not sure what is going wrong with your config. Have you checked the field name for username as &lt;CODE&gt;Event.UserData.EventInfo.Username&lt;/CODE&gt; and IP Address as &lt;CODE&gt;Event.UserData.EventInfo.IpAddress&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;You can run the following run anywhere example to check the fields yourself.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw=" &amp;lt;Event xmlns=\"http://schemas.microsoft.com/win/2004/08/events/event\" xml:lang=\"en-US\"&amp;gt;
 &amp;lt;System&amp;gt;
   &amp;lt;Provider Name=\"Microsoft-Windows-TerminalServices-Gateway\" Guid=\"{4D5AE6A1-C7C8-4E6D-B840-4D8080B42E1B}\" /&amp;gt; 
   &amp;lt;EventID&amp;gt;200&amp;lt;/EventID&amp;gt; 
   &amp;lt;Version&amp;gt;0&amp;lt;/Version&amp;gt; 
   &amp;lt;Level&amp;gt;4&amp;lt;/Level&amp;gt; 
   &amp;lt;Task&amp;gt;2&amp;lt;/Task&amp;gt; 
   &amp;lt;Opcode&amp;gt;30&amp;lt;/Opcode&amp;gt; 
   &amp;lt;Keywords&amp;gt;0x4020000001000000&amp;lt;/Keywords&amp;gt; 
   &amp;lt;TimeCreated SystemTime=\"2020-02-21T18:54:19.913701800Z\" /&amp;gt; 
   &amp;lt;EventRecordID&amp;gt;1219&amp;lt;/EventRecordID&amp;gt; 
   &amp;lt;Correlation ActivityID=\"{BEA11342-474B-47DE-907D-F2FBEBD40000}\" /&amp;gt; 
   &amp;lt;Execution ProcessID=\"5480\" ThreadID=\"8416\" /&amp;gt; 
   &amp;lt;Channel&amp;gt;Microsoft-Windows-TerminalServices-Gateway/Operational&amp;lt;/Channel&amp;gt; 
   &amp;lt;Computer&amp;gt;gatewayserver.domain.com&amp;lt;/Computer&amp;gt; 
   &amp;lt;Security UserID=\"S-1-5-20\" /&amp;gt; 
   &amp;lt;/System&amp;gt;
 &amp;lt;UserData&amp;gt;
 &amp;lt;EventInfo xmlns=\"aag\"&amp;gt;
   &amp;lt;Username&amp;gt;domain\username&amp;lt;/Username&amp;gt; 
   &amp;lt;IpAddress&amp;gt;173.x.x.x&amp;lt;/IpAddress&amp;gt; 
   &amp;lt;AuthType&amp;gt;NTLM&amp;lt;/AuthType&amp;gt; 
   &amp;lt;Resource /&amp;gt; 
   &amp;lt;ConnectionProtocol&amp;gt;HTTP&amp;lt;/ConnectionProtocol&amp;gt; 
   &amp;lt;ErrorCode&amp;gt;0&amp;lt;/ErrorCode&amp;gt; 
   &amp;lt;/EventInfo&amp;gt;
   &amp;lt;/UserData&amp;gt;
 &amp;lt;RenderingInfo Culture=\"en-US\"&amp;gt;
   &amp;lt;Message&amp;gt;The user \"domain\username\", on client computer \"173.x.x.x\", met connection authorization policy requirements and was therefore authorized to access the RD Gateway server. The authentication method used was: \"NTLM\" and connection protocol used: \"HTTP\".&amp;lt;/Message&amp;gt; 
   &amp;lt;Level&amp;gt;Information&amp;lt;/Level&amp;gt; 
   &amp;lt;Task /&amp;gt; 
   &amp;lt;Opcode /&amp;gt; 
   &amp;lt;Channel /&amp;gt; 
   &amp;lt;Provider /&amp;gt; 
 &amp;lt;Keywords&amp;gt;
   &amp;lt;Keyword&amp;gt;Audit Success&amp;lt;/Keyword&amp;gt; 
   &amp;lt;/Keywords&amp;gt;
   &amp;lt;/RenderingInfo&amp;gt;
   &amp;lt;/Event&amp;gt;"
| spath
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 Feb 2020 01:22:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475302#M31206</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-02-22T01:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing XML into fields is not working properly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475303#M31207</link>
      <description>&lt;P&gt;&lt;CODE&gt;spath&lt;/CODE&gt; is good.&lt;/P&gt;

&lt;P&gt;I try to extract by &lt;EM&gt;props.conf&lt;/EM&gt; and &lt;EM&gt;transforms.conf&lt;/EM&gt; &lt;BR /&gt;
props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[XML_sample]
NO_BINARY_CHECK = 1
REPORT-xml_first = xml_first
REPORT-xml_second = xml_second
SHOULD_LINEMERGE = 0
TIME_FORMAT = %FT%T.%9QZ
TIME_PREFIX = SystemTime=\"
TZ = UTC
pulldown_type = 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[xml_first]
CLEAN_KEYS = 0
REGEX = (?:\&amp;lt;)?([\w \:]+?)=\"(\S+)\"
FORMAT = $1::$2

[xml_second]
CLEAN_KEYS = 0
REGEX = \&amp;lt;(\w+)\&amp;gt;([^\&amp;lt;]+)&amp;lt;\/\1\&amp;gt;
FORMAT = $1::$2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was able to extract it.&lt;BR /&gt;
It's not easy.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Feb 2020 01:54:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475303#M31207</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-22T01:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing XML into fields is not working properly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475304#M31208</link>
      <description>&lt;P&gt;Tried it as shown and it worked. However, if I collapse the XML into a single line of text (like it is as it gets ingested), it breaks. Played with it a bit and it looks like the &lt;CODE&gt;&amp;lt;Message&amp;gt;&lt;/CODE&gt; section is what breaks it because the &lt;CODE&gt;makeresults&lt;/CODE&gt; parses fine when I remove it.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2020 16:28:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475304#M31208</guid>
      <dc:creator>aaronzabell</dc:creator>
      <dc:date>2020-03-18T16:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing XML into fields is not working properly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475305#M31209</link>
      <description>&lt;P&gt;Should my &lt;CODE&gt;props.conf&lt;/CODE&gt; and &lt;CODE&gt;transforms.conf&lt;/CODE&gt; look exactly as you have them? And is &lt;CODE&gt;REPORT-xms_second&lt;/CODE&gt; a typo? I tried it as written and as &lt;CODE&gt;REPORT-xml_second&lt;/CODE&gt; but it didn't make a difference either way.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2020 16:46:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475305#M31209</guid>
      <dc:creator>aaronzabell</dc:creator>
      <dc:date>2020-03-18T16:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing XML into fields is not working properly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475306#M31210</link>
      <description>&lt;P&gt;Looking at the live data again. &lt;CODE&gt;&amp;lt;message&amp;gt;&lt;/CODE&gt; gets parsed.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2020 18:20:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475306#M31210</guid>
      <dc:creator>aaronzabell</dc:creator>
      <dc:date>2020-03-18T18:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing XML into fields is not working properly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475307#M31211</link>
      <description>&lt;P&gt;Looking more at the live data. The following section of the XML gets parsed into a single feild called &lt;CODE&gt;UserData_Xml&lt;/CODE&gt; Still no idea how to have it parse deeper.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;EventInfo xmlns="aag"&amp;gt;
   &amp;lt;Username&amp;gt;domain\username&amp;lt;/Username&amp;gt; 
   &amp;lt;IpAddress&amp;gt;173.x.x.x&amp;lt;/IpAddress&amp;gt; 
   &amp;lt;AuthType&amp;gt;NTLM&amp;lt;/AuthType&amp;gt; 
   &amp;lt;Resource /&amp;gt; 
   &amp;lt;ConnectionProtocol&amp;gt;HTTP&amp;lt;/ConnectionProtocol&amp;gt; 
   &amp;lt;ErrorCode&amp;gt;0&amp;lt;/ErrorCode&amp;gt; 
   &amp;lt;/EventInfo&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Mar 2020 18:26:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475307#M31211</guid>
      <dc:creator>aaronzabell</dc:creator>
      <dc:date>2020-03-18T18:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing XML into fields is not working properly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475308#M31212</link>
      <description>&lt;P&gt;I see , second is typo. &lt;BR /&gt;
my answer is updated. &lt;BR /&gt;
In my splunk, this works.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2020 18:31:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475308#M31212</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-18T18:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing XML into fields is not working properly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475309#M31213</link>
      <description>&lt;P&gt;Tried it but no change. Still not parsing everything in the XML data.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2020 23:42:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475309#M31213</guid>
      <dc:creator>aaronzabell</dc:creator>
      <dc:date>2020-03-18T23:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing XML into fields is not working properly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475310#M31214</link>
      <description>&lt;P&gt;my splunk works, I don't know missing fields and restart,&lt;BR /&gt;
good luck&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2020 08:56:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475310#M31214</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-19T08:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing XML into fields is not working properly</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475311#M31215</link>
      <description>&lt;P&gt;I ended up doing a custom field extraction for the fields I wanted. I had to write my own regex since the auto regex wasn't cooperating.&lt;/P&gt;

&lt;P&gt;For username:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^(?:.*)&amp;lt;Username&amp;gt;(?P&amp;lt;username&amp;gt;[^&amp;lt;]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For source IP:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^(?:.*)&amp;lt;IpAddress&amp;gt;(?P&amp;lt;src_ip&amp;gt;[^&amp;lt;]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For the workstation that the user connects to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^(?:.*)&amp;lt;Resource&amp;gt;(?P&amp;lt;workstation&amp;gt;[^&amp;lt;]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Mar 2020 21:58:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Parsing-XML-into-fields-is-not-working-properly/m-p/475311#M31215</guid>
      <dc:creator>aaronzabell</dc:creator>
      <dc:date>2020-03-19T21:58:26Z</dc:date>
    </item>
  </channel>
</rss>

