Apr 29 2020 03:06 AM
Apr 29 2020 03:06 AM
Do you know a way to comment and uncomment multiple lines in the Logs Blade in Azure Sentinel ? I find it not convenient to type "//" every time.
Is there a way to create a custom shortcut for it ?
Apr 29 2020 04:50 AM
@emmanuelnguyen You made me chuckle a little bit. Personally, I think its much easier to type two slashes (//) than some of the other remarking operators for other query and scripting platforms.
However, you can use something like AutoHotkey (https://www.autohotkey.com/) to develop your own keyboard shortcuts that and assign the KQL commenting operator to a custom keystroke combination.
I think its awesome that you're commenting, though. Commenting in the queries is a perfect example of a best practice for developing queries that can be shared and redistributed with colleagues and teammates, but also available to quickly comprehend at a later date.
Apr 29 2020 05:01 AM
@emmanuelnguyen There is currently no block comment in KQL. The editor in Azure Sentinel has no macro or shortcut feature so you would need to enter the "//" for each line.
Well, that is not entirely true. There is a Command Palette that you can access by pressing F1 and there is a "Insert Line Comment" that is supposed to work by pressing Ctrl-K, Ctrl-C but it does not appear to work (at least not in my environment)
Apr 30 2020 09:05 AM
@rodtrent I agree with you, that two slashes "//" are a good and fast way to comment one line. But I think it's too bad that there aren't a way to comment a block/multiple lines with only one shortcut, rather than typing "//" at each line.
What is weird is that in the command palette, as @Gary Bushey said, there is a command line for that "Toggle Block Comment" --> "Shift+Alt+A" but it's not working in my environment. And it seems that I'm not the only one.
Thank you for the recommendation about AutoHotkey, although I'm not certain that it will allow me to do this precise operation.
May 03 2022 05:55 PM
Not sure if it is too late to reply to this thread but I came across this and did a bit of search.
Control+K+C works for me to comment multiple lines in Kusto
Control+K+U is for uncommenting lines. Tested and it worked for me without any problems.
Seems these are the shortcuts used in Visual Studio too.
Hope this helps someone.