Splunk SOAR (f.k.a. Phantom)

Count the Number of Parent Playbooks a given playbook has

jenniandthebets
Explorer

Hey folks, does anyone know of a straightforward way to get a count of the number of times each playbook is used as a subplaybook? I know you're able to click into the playbook and look to see where it's being used, but I was hoping to do so at a large scale without having to click into every single playbook.

I've got some changes coming that will require a fair number of playbooks to be updated and was hoping to use the count to help determine where to prioritize our effort.

Labels (1)
1 Solution

SOARt_of_Lost
Path Finder

If you use external source control (such as gitlab), this is fairly easy. You can pull down the repo then parse through all of the .json files. Anytime a playbook calls another, it's added to the json with the key "playbookName". My quick and dirty powershell code was once I cloned the repo was 

Get-ChildItem -Path "[repo path]\*.json" -Recurse | Select-String -Pattern "[playbookName]" -AllMatches | Select-Object -Property Line | Export-Csv -Path [csv path].csv

 

It's a little tougher if you don't have that easily accessible externally. My best guess (which I haven't personally tested) would be to use the API to loop through every playbook by id, then parse your way down  to that playbookName and count it. Make sure you don't stop at the first match, as there's a chance more than one subplaybook is called.

View solution in original post

SOARt_of_Lost
Path Finder

If you use external source control (such as gitlab), this is fairly easy. You can pull down the repo then parse through all of the .json files. Anytime a playbook calls another, it's added to the json with the key "playbookName". My quick and dirty powershell code was once I cloned the repo was 

Get-ChildItem -Path "[repo path]\*.json" -Recurse | Select-String -Pattern "[playbookName]" -AllMatches | Select-Object -Property Line | Export-Csv -Path [csv path].csv

 

It's a little tougher if you don't have that easily accessible externally. My best guess (which I haven't personally tested) would be to use the API to loop through every playbook by id, then parse your way down  to that playbookName and count it. Make sure you don't stop at the first match, as there's a chance more than one subplaybook is called.

jenniandthebets
Explorer

This worked like a charm - thank you!

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...