Community Blog
Get the latest updates on the Splunk Community, including member experiences, product education, events, and more!

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

CaitlinHalla
Splunk Employee
Splunk Employee

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to use the Splunk AI Assistant by exploring practical, real-world, real-time examples. Specifically, this series goes into the specific Splunk AI Assistant use cases of:

  1. Identifying unknown unknowns
  2. Analyzing and troubleshooting in real-time 
  3. Auditing compliance and cost 
  4. Explaining metrics and providing feedback
  5. Onboarding new hires or new users of Splunk Observability Cloud
  6. Observability as Code

If you’d like to start at the beginning of this series, check out: Identifying Unknown Unknowns.

In this sixth post, we’ll explore how the Splunk AI Assistant can be used to generate scripts that serve as a launchpad for automation code using the Splunk Observability Cloud API. 

Generating Scripts with the Splunk AI Assistant

As an engineer or administrator of Splunk Observability Cloud, I may want to automate tasks related to observability resources using the Splunk AI Assistant and the Splunk Observability Cloud API. 

The AI Assistant is pretty flexible in terms of the types of questions you prompt it with, as long as the questions are related to the code integrated with Splunk Observability Cloud and the data within it. We can ask the AI Assistant to generate code that interacts with the Splunk Observability Cloud API. For example, I can ask the AI Assistant to write a Python script that adds my user to a team in Splunk Observability Cloud – all that I will need is my user ID, and the team ID I want to add my user to. 

To grab my user ID, I’ll navigate to my profile in Splunk Observability Cloud and copy and save my user ID: 

And then I’ll navigate to the team and grab its ID: 

Team ID.png

Note: you’ll notice my user, Caitlin Halla, is not currently a member of this team.

Using my user ID and this team ID, we can then prompt the AI Assistant to write a Python script that adds me, user GQSnQ4TAwAg, to team Fuqe6XzA4AA using the Splunk Observability Cloud API. The response we get from this prompt includes the code we’ll need for our Python script: 

python script response.png

We can then copy and paste this code into our code editor and replace the placeholders and required values, like our access token (with administrative access), with real values: 

python script in vscode.png

After running our script, if we navigate back to the team in Splunk Observability Cloud, we can see that my user was successfully added to this team: 

successfully added to Team.png

Wrap up

To summarize what we explored in this post, we learned how the Splunk AI Assistant can help us generate a Python script to automate specific tasks, like adding a Splunk Observability Cloud user to a specific team. This type of interaction with the Splunk AI Assistant highlights the ability to use the Assistant for Observability as Code. The AI Assistant can provide you with code that interacts with the Splunk Observability Cloud API and draft SignalFlow programs that you can then insert into charts. It can even generate the charts via Python scripts. 

With the Splunk AI Assistant, observability possibilities are continually expanding. In this series, we’ve discussed some of the use cases currently available within the AI Assistant, but these will only evolve and get better with time. As features expand, we look forward to seeing you in a future AI Assistant series.

Want to try out the Splunk AI Assistant for yourself? Start with a 14-day free trial! Already a Splunk Observability Cloud customer? Reach out to your account representative to enable the Splunk AI Assistant!  

Resources 

Get Updates on the Splunk Community!

Why You Can't Miss .conf25: Unleashing the Power of Agentic AI with Splunk & Cisco

The Defining Technology Movement of Our Lifetime The advent of agentic AI is arguably the defining technology ...

Deep Dive into Federated Analytics: Unlocking the Full Power of Your Security Data

In today’s complex digital landscape, security teams face increasing pressure to protect sprawling data across ...

Your summer travels continue with new course releases

Summer in the Northern hemisphere is in full swing, and is often a time to travel and explore. If your summer ...