Skip to main content

I have a logfile I need to extract some info from but I'm not sure what to use. Here's an example of what I have.

<Msg time="2023-06-05T19:55:23,511" type="INFO" code="9029" source="Rest" process="35236" thread="1" methodName="" 

Are all lines like this or is it part of an XML?


Here is a complete line, they're all like this.

Line 45395: <Msg time="2023-06-05T19:07:29,797" type="INFO" code="6690" source="Admin" process="35236" thread="1" methodName="" machine="randomsite.com" user="" elapsed="" requestID="9c1dc9ba-9c69-437c-b66b-dddf2f6adef0">Service input directory 'F:\\arcgisserver\\directories\\arcgissystem\\arcgisinput\\Hosted\\MY_FS.FeatureServer.delete' is successfully deleted.</Msg>

 


You can use a XMLFlattener to parse this.

  • Feed the logfile to the XMLFlattener.
  • Set Elements to match = "Msg"
  • Under Flatten Options, choose Enable Flattening
  • In Attributes to Expose enter what you need (Msg.code, Msg.elapsed, Msg.machine, Msg.methodName, Msg.process, Msg.requestID, Msg.source, Msg.thread, Msg.time, Msg.type, Msg.user)

If these xml fragments are part of a larger log file you'll first need to get the individual fragments. Hard to say without seeing the whole log file but a html extractor might work hereimageSet the return format to list attribute, explode the list and then you can use that value within the XMLFlattener


Reply