Getting Data In

How to index XML data in Splunk without row. prefix?

slopez100
New Member

My XML is as follows:

<row>
    <Id>1</Id>
    <PostId>7</PostId>
    <UserId>2</UserId>
    <VoteTypeId>2</VoteTypeId>
    <CreationDate>2009-11-06T02:22:37.063</CreationDate>
    <TargetUserId>7</TargetUserId>
    <TargetRepChange>10</TargetRepChange>
    <IPAddress>64.127.105.60</IPAddress>
</row>
<row>
    <Id>2</Id>
    <PostId>6</PostId>
    <UserId>2</UserId>
    <VoteTypeId>2</VoteTypeId>
    <CreationDate>2009-11-06T02:22:38.25</CreationDate>
    <TargetUserId>31</TargetUserId>
    <TargetRepChange>10</TargetRepChange>
    <IPAddress>64.127.105.61</IPAddress>
</row>

Splunk labels the columns as row.id, row.IPAddress, etc.

Is there a way to have the fields indexed in splunk without the "row." prefix. I've looked at FIELDALIAS and some other items but they don't do what I'm seeking.

Any help will be greatly appreciated.

Thanks in advance.

Scott

Tags (3)
0 Karma

trsavela
Path Finder

Try this:

| rename  "row."* as *

somesoni2
Revered Legend

Give this a try (props.conf)

[yoursourcetype]
BREAK_ONLY_BEFORE=<Id>
CHARSET=AUTO
MAX_TIMESTAMP_LOOKAHEAD=150
NO_BINARY_CHECK=1
SEDCMD-acrRemover=s/\x0D//g
SEDCMD-aremove=s/\<row\>//g
SEDCMD-blfRemover=s/\x0A//g
SEDCMD-bremove=s/\<\/row\>//g
SEDCMD-cRemove=s/\<\/\w+\>//g
SEDCMD-dRemove=s/\</" /g
SEDCMD-eRemove=s/\>/="/g
SEDCMD-fRemove=s/^"//g
SHOULD_LINEMERGE=true
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...