Comments in Search Queries
On the Search page, you can add comments and comment out lines of your query using comment formatting, as follows:
//- Comments out a single line of the query, or a part of a single line.
/* */- Creates a multiple line comment.
Use the keyboard shortcut command + / on macOS or control + / on Windows to generate comment formatting on the selected line(s) in your query.
Comments can be useful for the following use cases:
- Add comments to your search query in order to add context for users who may want to use or edit your queries at a later date.
- Comment out single lines or multiple lines to troubleshoot your query while you are writing it.
When you comment out a line of your search query, the user interface displays the commented text as grey and italic. See the following example of commenting out a single line in a query:
If the query is valid without the line that is commented out, it will still run when you click Start.
where statement is commented out in the above statement.
The following is a multi-line comment.
Pro Tip: Sumo Logic App Queries as Examples
Sumo Logic Apps are a great resource of example search queries. You can review and even run searches from Sumo Logic Apps without installing them. To view available Sumo Logic Apps, click the Library icon.
at the top of the UI (Library > Apps in the classic UI). You can also copy content from the Library, and use it as a starting point to create your own queries. When you do that, you can comment out the aggregation lines of the query and replace them with your own. You can also delete them of course, but commenting them out instead would make them available for reference later.