We would like to add an XML comment to the beginning of our pre-built panel files.
However, when we have the comment before the element, we get the following error:
Error parsing prebuilt dashboard panel.
I can't seem to find any documentation that says this is allowed, nor any that says its disallowed.
Does anyone know if this is legal? Or how to get it to work?
It seems like a bug in the parser, otherwise it should ignore the XML comment.
Thanks.
After opening up a case with Splunk about this issue, they have created
BUG: SPL-115294 - XML Comment before Tag causes parsing errors
I am waiting to hear if this will be resolved, or not.
Until then, either move the XML comment to the inside of the tag, or use the workaround they provided for me now is to use the following:
<![CDATA[
# ========================================================
# this is the panel that odes the following
# second line of comment
# ========================================================
# -->
]]>
<panel>
Update:: the CDATA tag can not be before the tag...It causes an error in their editor. See below.
Hope this help someone.
After opening up a case with Splunk about this issue, they have created
BUG: SPL-115294 - XML Comment before Tag causes parsing errors
I am waiting to hear if this will be resolved, or not.
Until then, either move the XML comment to the inside of the tag, or use the workaround they provided for me now is to use the following:
<![CDATA[
# ========================================================
# this is the panel that odes the following
# second line of comment
# ========================================================
# -->
]]>
<panel>
Update:: the CDATA tag can not be before the tag...It causes an error in their editor. See below.
Hope this help someone.
Discussed this with Splunk Support and they have acknowledged this is a problem with Splunk Enterprise 6.2.6, but have decided to not fix it until a later product release.
I was told the parser is being rewritten in 6.4, and it will be working then.
Until then the workaround is to put the panel tag before any comment or CDATA tag.
<panel>
<!--
# ========================================================
# this is the panel that odes the following
# second line of comment
# ========================================================
# -->
Here is an example of the beginning of one of our files.
<!--
# ========================================================
# this is the panel that odes the following
# second line of comment
# ========================================================
# -->
<panel>
etc.
</panel>
It should work. The syntax for XML comments is:
<!-- My comment here -->
Make sure you place it beneath one of your panel tags.
This doesn't work if you place the comment at the beginning of a prebuilt dashboard. Move it after the <panel> tag and you're good to go.
Can't supply any documentation for this unfortunately, simply tried and it worked.
So in other words, its a bug in their parser.
I added a multiline XML comment before the first line tag, and the parser is complaining with the error I stated in my original post.
The xml code screen is showing the multiline comment as a comment, so the Splunk XML editor believe it is a comment, just not the parser.
I can confirm this works (kinda). Sometimes on larger dashboards, comments may move, but I haven't found out what triggers that behavior.
Correction: it works inside a dashboard, not at the beginning of prebuilt panels.