是否可以在 Splunk 中僅使用 SimpleXML 在調色板運算式中使用變數?我有以下欄位:
我的領域:
mySearch | eval myField = 100
在 Splunk 中,我有一張桌子。該表僅回傳帶有數字的行(例如 16,123,644 等)。根據值更改這些行的顏色的作業方式如下:
調色板:
<format type="color" field="sourceField">
<colorPalette type="expression">if (value > 100 ,"#df5065","#00FF00")</colorPalette>
</format>
如果 sourceField 大于 100,則具有該值的行為紅色。任何其他值都會將行著色為綠色。我想調整上面的代碼以包含變數myField以便我可以根據變數更改顏色。我嘗試了以下方法:
<format type="color" field="sourceField">
<colorPalette type="expression">if (value > myField ,"#df5065","#00FF00")</colorPalette>
</format>
<format type="color" field="sourceField">
<colorPalette type="expression">if (value > $myField$ ,"#df5065","#00FF00")</colorPalette>
</format>
<format type="color" field="sourceField">
<colorPalette type="expression">if (value > 'myField' ,"#df5065","#00FF00")</colorPalette>
</format>
<format type="color" field="sourceField">
<colorPalette type="expression">if (value > (myField) ,"#df5065","#00FF00")</colorPalette>
</format>
但以上都不起作用。
是否可以在上述調色板運算式中包含變數,如果可以,我該怎么做?提前致謝。
uj5u.com熱心網友回復:
要在 XML 中使用搜索查詢的結果,請嘗試$results.myField$。
uj5u.com熱心網友回復:
我做了什么讓它作業:
<format type="color" field="sourceField">
<colorPalette type="expression">if (value > $mytoken$ ) ,"#df5065",default)</colorPalette>
</format>
和 :
<done>
<set token="mytoken">$result.myField$</set>
</done>
我也試過(對我不起作用):
<format type="color" field="sourceField">
<colorPalette type="expression">if (value > $result.average$ ) ,"#df5065",default)</colorPalette>
</format>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/331664.html
上一篇:XMLSerializer例外“有一個錯誤反映欄位”和“對于非陣列型別,您可以使用以下屬性:XmlAttribute,..”
