Using comments in SPL2

You can add comments to your SPL2 search string to explain a portion of a search, or to use as a troubleshooting technique. SPL2 supports both block comments and line comments.

  • Block comments use this tagging: /* ... */
  • Line comments use this tagging: //

Block comments

SPL2 block comments begin with a leading forward slash followed by an asterisk and end with a trailing asterisk and forward slash.

For example, suppose you have the following search:

You want to add a comment that explains what the k field contains.

Here's another example.

The following search classifies recent earthquakes based on their depth:

When you add comments to a search, the search is easier to understand. This is the same search with multiple block comments added to explain each part of the search:

Alternatively, you can use block comments at the start or end of a search string. For example:

Note: You cannot have block comments in any portion of your search that uses the search command.

Line comments

You can use line comments within any SPL2 command in your search pipeline. Line comments begin with a double forward slash ( // ) and end with a new line.

For example:

Keyboard shortcut for line comments

You can use a keyboard shortcut to add or remove line comments.

Select one or more rows in your module and apply the keyboard shortcut for your operating system:

Windows or *nix

Ctrl + /

MacOs

Command + /

Using comments to troubleshoot a search