^^^I had to use \ before each tag so that it wasn't read as actual XML^^^
What I want to do is split this single event into mutiple events each containing the information within each <row> tag (all the info in the row tag as well as teh embedded <col> tags).
So all of this would be in it's own separate message/event
Any idea how I can do that? I've asked before but the guy wasn't able to help. I've been working on this for a couple days now. I know it's possible. I've read everything about the split filter but that doesn't give any examples for XML.
From what I can tell split doesn't easily support xml.
If you have multiple values in the same message, which is what I think you're saying, then you could try parsing the xml then running the split over the results - as suggested in this post.
Just note that you can't run the xml filter on invalid xml, so you would have to wrap the row items in a containing tag before putting it through the xml plugin.
I know that my XML is valid, because I am able to parse out each item with the "row" tags and place them in a separate field. (I didn't include all of the xml in the screen shot because I didn't it was necessary). So that part works just fine.
But you're saying that add_field => {"newfield" => "<something>%{message}</something>"} is going to be INSIDE the XML plugin? I thought it would be within a Split plugin.
I think that does, yes. At least it helps point me in a better direction.
When you say it "produces two events that look like:" do those two events have different col[0] values? Meaning one has OMXEOC0 and the other has PWXLST02? Or are both values the same?
If they are different then that's EXACTLY what I need.
No - sorry - without the full picture of the xml I assumed that was the whole snippet. Looks like you have a solution well on the way with @Badger's input below. Good luck!
It may be clearer if you run it once without the split filter. With the xml filter target option set to parsed, that XML will result in an event that has a [parsed] field that contains an array called [rows]. So the array you want to split is [parsed][rows]
Ok, you're right that makes way more sense. However, when my target option is set to "parsed". I get two different fields, one called "parsed.report" (which has that array but also other arrays with different info) and one called "parsed.server".
So my code looks like this split { field => "[parsed.report][row]" } but I get a split type error. Any thoughts on that?
I had to split the parsed.report field first, then split one of the resulting fields which was parsed.report.row.
So this is the code that solves my problem:
split { field => "[parsed][report]" }
split { field => "[parsed][report][row]"}
Thank you both for all the help! I've been trying this for so long, I almost broke my brain.
Successfully made an HTTP request from logstash to a z/OS Mainframe's RMF Distributed Data Server for CPU information in ELK. <--- In case anyone in the future needs to know how to do this.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.