Splunk Search

Keyboard Shortcut to Format Search

JoshWhaley
Path Finder

At .conf this year, a new feature was showed off that allowed auto-formatting of SPL in the search bar with the press of a button in 6.5. It took a search from a single line:

index=myindex | stats count by action

to multiple lines:

index=myindex
| stats count by action

Does anyone know what the key is that accomplishes this?

1 Solution

benspader
Explorer

Answer is Ctrl + Shift + F
That will make your SPL neat and clean!

ramgnisiv
Path Finder

So how about unformatting?

To get everything back into a single line.

This will solve the issue for people that use savedsearches.conf stanza's where formatted code copy pasted from splunk GUI will cause everything after the first PIPE to be ignored by the savedsearch configuration on the search head.

0 Karma

christopherr_sp
Splunk Employee
Splunk Employee

A similar question was asked by a customer who uses a Norwegian Keyboard (below):

https://www.datacal.com/image/popup?imagePath=%2fimages%2fproduct%2flarge%2f310.jpg

There is a §| key above the Tab key (left of the 1) and that produces the \ character within Splunk.

Pressing Ctrl+§| enables Search Bar formatting in Splunk 6.5.x. This was confirmed to work by the customer.

That is the same physical location of the ^ character on a German T2 Keyboard

https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:German-T2-Keyboard-Prototype-May-20...

(See also: https://answers.splunk.com/answers/459003/what-is-the-keyboard-shortcut-for-the-splunk-650-s.html)

bjoernhansen
Path Finder

OMG I love you so much... I tried all the combinations on my German keyboard to get that feature to work, but this (completely unrelated) key combo works fine. Yeah! 😄

0 Karma

tries
Path Finder

Did someone try this using a Mac and a german keyboard ? Even using BetterTouchTool I'm not able to simulate that shortcut.

0 Karma

alai
Explorer

On a Mac /w German keyboard cmd # should do the trick

JoshWhaley
Path Finder

Thank you for the link! Ctrl+\ did the trick!

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...