Dashboards & Visualizations

xml like log

cboillot
Contributor

I have a log that I am trying to parse and I am unable to figure this out. It looks like a type of XML file. Here is an example:

<ErrorMessage Id='20200130111127151' Date='1/30/2020' Time='11:11 AM' >
  <RequestInformation
     Hostname='1.2.3.4' 
     HostAddress='5.6.7.8'
     HostBrowser='Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.42000)'
     ReferringPage=''
     RequestType='POST'
     ContentLength='505'
     RawUrl='/dir/subdir/filename.asmx'>
    <Browser Type='IE6' Browser='IE' Version='6.0' Platform='Unknown' SupportsFrames='True' SupportsJavascript='True' SupportsTables='True'SupportsCookies='True'/>
    <Cookies>
    </Cookies>
    <Form>
    </Form>
  </RequestInformation>
  <Exception Message='ORA-01017: invalid username/password; logon denied'>
    <StackTrace>
      <![CDATA[
   at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable, OracleLogicalTransaction m_OracleLogicalTransaction)
   at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src, OracleLogicalTransaction m_oracleLogicalTransaction)
   at Oracle.DataAccess.Client.OracleConnection.Open()
   at dhss.webservice.login_ws.MExecuteComponent.AuthenticateToAPP(String UserID, String Password, String DBInstance, String ServerIP, String ServerPort)
]]>
    </StackTrace>
  </Exception>
</ErrorMessage>

I have the Add-on for Oracle database installed, but it don't seem to work with this one.

Tags (2)
0 Karma
1 Solution

dindu
Contributor

Hi,

You could try something like below during the search time by using the spath command
Please rename the fields and use table command to display the fields better,

     |makeresults
     |eval _raw="<ErrorMessage Id='20200130111127151' Date='1/30/2020' Time='11:11 AM' >
        <RequestInformation
           Hostname='1.2.3.4' 
           HostAddress='5.6.7.8'
           HostBrowser='Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.42000)'
           ReferringPage=''
           RequestType='POST'
           ContentLength='505'
           RawUrl='/dir/subdir/filename.asmx'>
          <Browser Type='IE6' Browser='IE' Version='6.0' Platform='Unknown' SupportsFrames='True' SupportsJavascript='True' SupportsTables='True'SupportsCookies='True'/>
          <Cookies>
          </Cookies>
          <Form>
          </Form>
        </RequestInformation>
        <Exception Message='ORA-01017: invalid username/password; logon denied'>
          <StackTrace>
            <![CDATA[
         at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable, OracleLogicalTransaction m_OracleLogicalTransaction)
         at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src, OracleLogicalTransaction m_oracleLogicalTransaction)
         at Oracle.DataAccess.Client.OracleConnection.Open()
         at dhss.webservice.login_ws.MExecuteComponent.AuthenticateToAPP(String UserID, String Password, String DBInstance, String ServerIP, String ServerPort)
      ]]>
          </StackTrace>
        </Exception>
      </ErrorMessage>"
      |spath input=_raw

You could also add KV_MODE = xml in the props.conf and breaking the lines appropriately

      KV_MODE = xml

View solution in original post

0 Karma

dindu
Contributor

Hi,

You could try something like below during the search time by using the spath command
Please rename the fields and use table command to display the fields better,

     |makeresults
     |eval _raw="<ErrorMessage Id='20200130111127151' Date='1/30/2020' Time='11:11 AM' >
        <RequestInformation
           Hostname='1.2.3.4' 
           HostAddress='5.6.7.8'
           HostBrowser='Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.42000)'
           ReferringPage=''
           RequestType='POST'
           ContentLength='505'
           RawUrl='/dir/subdir/filename.asmx'>
          <Browser Type='IE6' Browser='IE' Version='6.0' Platform='Unknown' SupportsFrames='True' SupportsJavascript='True' SupportsTables='True'SupportsCookies='True'/>
          <Cookies>
          </Cookies>
          <Form>
          </Form>
        </RequestInformation>
        <Exception Message='ORA-01017: invalid username/password; logon denied'>
          <StackTrace>
            <![CDATA[
         at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable, OracleLogicalTransaction m_OracleLogicalTransaction)
         at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src, OracleLogicalTransaction m_oracleLogicalTransaction)
         at Oracle.DataAccess.Client.OracleConnection.Open()
         at dhss.webservice.login_ws.MExecuteComponent.AuthenticateToAPP(String UserID, String Password, String DBInstance, String ServerIP, String ServerPort)
      ]]>
          </StackTrace>
        </Exception>
      </ErrorMessage>"
      |spath input=_raw

You could also add KV_MODE = xml in the props.conf and breaking the lines appropriately

      KV_MODE = xml
0 Karma

cboillot
Contributor

I have tried the KV_MODE = xml and it didn't seem to do anything.

0 Karma

dindu
Contributor

Set the linebreaker in props.conf as

     LINE_BREAKER = </ErrorMessage>
0 Karma

cboillot
Contributor

Now I am seeing results with tick marks, like this

'ASP.NET_SessionId'
0 Karma

cboillot
Contributor

looks like this might have been what was needed. thanks.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...