Syntax highlighting
With syntax highlighting the SPL commands, arguments, functions, and keywords are color-coded to make it easier to read a search.
Consider the following search.
sourcetype=access_* | timechart count(eval(action=purchase)) BY productName usenull=false useother=false
Syntax highlighting can make searches easier to read. Syntax highlighting shows commands, arguments, functions, and keywords in different colors. The following image shows a search string with syntax highlighting.
Syntax validation
If a command, argument, function, or boolean operator is not spelled or capitalized correctly, the term is not highlighted in color. The lack of color alerts you to incorrect syntax.
If you specify an incorrect data type for an argument, the data type appears in red. For example, the limit argument for the top command expects an integer. If you type ...|top limit=false the term false is highlighted in red because it is not an integer.
Turn off syntax highlighting
You can turn syntax highlighting colors off by turning off the advanced editor. This is useful for people who have difficulty distinguishing between different colors.
However, be aware that when the advanced editor is turned off, the color themes, auto-formatting, and line numbering features are not available.
- On the Splunk bar, select [User_account_name] > Preferences.
- Click SPL Editor.
- Turn off Advanced editor.
- Click Apply.