Category: Splunk

  • Enhanced Troubleshooting for Blocked Queues

    Enhanced Troubleshooting for Blocked Queues

          By: Eric Howell | Splunk Consultant

     

    Overview

    Splunk’s method of ingesting and storing data follows a specific set of actions. These actions (e.g. event parsing, timestamping, indexing, etc) are separated logically and performed in different pipelines. Please refer to the below, Splunk-provided breakdown in which queue/pipeline these activities are performed.

    Diagram of the Splunk data ingestion pipeline showing parsing, merging, typing and indexing stages with associated queues and processes.

     

    As you can see, actual ingestion of data into Splunk has many different processes that are followed before the data finally finds its resting place within a bucket. At each stage, a configuration file (props.conf or transforms.conf for the majority of activities) will dictate what is done, often tied to provided regex within the .conf file or other attributes within the file. Since there is no one-size-fits-all method to ingesting that expansive myriad of data types and formats that can be brought into Splunk, to say nothing of formatting issues that can happen to a log or data stream, custom ingestion settings are frequently configured to ensure proper data integrity and consistency.

    This also creates a number of places where a configuration or attribute can create conflict (e.g. greedy regex, improper implementation of the “Big 8” props.conf configurations, etc) and cause Splunk to spend more time than absolutely necessary to parse, type, aggregate, or index quickly. These issues may go unnoticed for a long period of time until a larger volume data stream is ingested or during a period of greater activity on the servers providing their logs to Splunk, at which point you can experience significant slow-down in your ingestion process. This can lead to events becoming searchable seconds, minutes, hours (or worse) later than the actual inciting time frame. This could have heavy impact during an outage when teams are attempting to triage or troubleshoot and return an environment to full function.

    Quickly and effectively identifying which queues are being blocked, or causing slow down, is relatively straightforward, but there are configurations that can be implemented to enrich your internal logs to help you pinpoint specific sourcetypes that are your pain points.

    Initial Troubleshooting

    You have determined that events are arriving later than expected, and you suspect that queues are being blocked. The next step would be to determine which specific queues are being blocked. The search provided below will provide insight on which queues are experiencing blocks:

    index=_internal source=$SPLUNK_HOME/var/log/splunk/metrics.log  blocked=true

    (replace $SPLUNK_HOME with wherever your Splunk install is located on your server)

     

    Your results will provide something like this:

    Screenshot of a Splunk log entry detailing a blocked typing queue with metrics for current and maximum queue sizes.

     

    In this example, the typing queue is the blocked queue in question. Now, you’ll be wondering, what exactly am I to do with that? Without additional configurations, the metrics.log is missing some of the robust functionality that will help you pinpoint the specific sourcetype causing the block, but you can reference this information against your knowledge of the ingestion pipeline (the image included at the top of this document) to troubleshoot settings that could be causing slowness during this process.

    It is important to remember the order of queues in the pipeline, as the the queues later in the pipeline experiencing blocks will cause upstream queues to fill up, as well.

    Additionally, the Monitoring Console can provide visualizations to help identify blocked queues by navigating to Indexing- > Performance -> Indexing Performance : Instance (or Advanced).

     

    Expanding Functionality

    You can enrich your visualizations by making a change to limits.conf on your indexers and forwarders. This will provide CPU time information for the RegexProcessor process in metrics.log for host, source, sourcetype, and index.

    Splunk documentation showing the regex_cpu_profiling configuration option to enable CPU time metrics for RegexProcessor.

    This configuration change needs to be made under the [default] stanza. Implemented correctly, the above configuration will look something like this:

    [default]

    regex_cpu_profiling = true

    With this change configured, and your metrics.log providing more robust information, several additional panels in the Monitoring Console will populate with data. These are found here:

    Indexing- > Performance -> Indexing Performance : Advanced

    With this information, you should be able to identify the specific sourcetype that is causing your queue blockages and troubleshoot the configurations specific to that data so as to resolve your issue.

     

    Want to learn more troubleshooting tips for blocked queues? Contact us today!

  • Hide Rows or Panels in Splunk Dashboards

    Hide Rows or Panels in Splunk Dashboards

    By: Yetunde Awojoodu  | Splunk Consultant

    Imagine a use case requirement to present metrics for multiple application groups in a single Splunk dashboard for the NOC with the different application groups also interested in viewing the same metrics for their hosts. Rather than creating a separate dashboard for each application group in addition to the consolidated one for the NOC, one dashboard could address the requests from all the teams. Note however that in this situation, the data presented in the dashboard can be viewed by all the groups.

    These requests can be met by hiding panels or rows in one dashboard. There are perhaps multiple ways to hide panels or rows within a dashboard, but I will be demonstrating how to do so using XML. Your scenario may be quite different from mine but if you need to hide panels or rows, this article should show you how to do so. For simplicity of understanding, my sample data includes only three groups. I have also provided the hypothetical data I used in case you would like to get hands-on in your test lab to understand the way this works. It includes average CPU and memory values for each application group.

    Screenshot of a CSV-style data table showing CPU and memory usage by host and group over a timestamp.

    I will demonstrate this concept using two scenarios. In the first scenario, the application groups would like to view both CPU and memory data for their groups only and the panels for each group appear on a single row in the dashboard. In the second scenario, the NOC wants to see only panels for memory data for all the groups.

    Scenario I – View Only a Selected Row

    First, create your dashboard panels, one panel per metric type with a suitable visualization. At this stage, my dashboard looks like this with average CPU and memory for each application group.

    Splunk dashboard showing average CPU and memory usage by host, segmented by group with bar and gauge visualizations.

    Once you have created the panels needed, create an input with a value for each application group. I have selected the dropdown input because it appears to work best when hiding panels or rows due to the setting and unsetting of tokens. My input configuration looks like this:

    Splunk dashboard editor showing token configuration for a dropdown labeled "Application Group" using the token row_tok.
    Static options for a Splunk dropdown input showing values for application groups including All, CMM, BBC and MNS.

    To hide rows or panels, you will need to include a “change” section in your XML as shown below, making sure to create a token for each group and set or unset tokens based on the panels you would like to see when a particular group is selected.  Also remember to include a depends attribute for each row or panel you are referencing. Here is the change section in my dashboard XML:

    <change>

    <condition label=”All”>

    <set token=”CMM_token”>true</set>

    <set token=”BBC_token”>true</set>

    <set token=”MNS_token”>true</set>

    </condition>

    <condition label=”CMM”>

    <set token=”CMM_token”>true</set>

    <unset token=”BBC_token”></unset>

    <unset token=”MNS_token”></unset>

    </condition>

    <condition label=”BBC”>

    <set token=”BBC_token”>true</set>

    <unset token=”CMM_token”></unset>

    <unset token=”MNS_token”></unset>

    </condition>

    <condition label=”MNS”>

    <set token=”MNS_token”>true</set>

    <unset token=”CMM_token”></unset>

    <unset token=”BBC_token”></unset>

    </condition>

    </change>

    The snapshot below shows a section of my XML including how the depends attribute is specified for each row or panel that may be hidden.

    Snippet of Splunk dashboard source code with red highlights around XML logic controlling row visibility using row_tok token.

    I have selected BBC only in the screenshot below to show you what the dashboard will look like when only one row is selected after configuring hidden rows.

    Splunk dashboard filtered by "BBC" group, showing CPU and memory usage visualizations for relevant hosts.

    Scenario II – View Only Selected Panels

    As in the first scenario, create your panels and configure an input suitable for your use case. I have selected the dropdown input and my configuration looks like this:

    Splunk dashboard editor showing dropdown token configuration for a selector labeled "Metric" using the token panel_tok.
    Static dropdown options in Splunk showing metric choices: All, CPU, and Memory, configured with token suffix settings.

    In this case, after creating tokens for the values in the change section, the “depends” attribute will be specified with each panel rather than each row as in the first scenario. The CPU_token was created for the CPU panels and MEM_token for memory panels. Below is a snapshot of a section of the XML:

    Splunk dashboard XML code highlighting how panel_tok controls the conditional visibility of panels based on selected metric.

    In the screenshot below, I have selected only panels with memory metrics.

    Splunk dashboard displaying average memory usage by host, segmented by group (CMM, BBC, and MNS), with horizontal bar charts for each group panel dynamically shown based on the selected “Memory” metric.

    In summary, hiding panels or rows in a dashboard can be achieved by simply setting and unsetting tokens and specifying the “depends” attribute in the XML for each panel or row. In my opinion, this method is quite straight forward compared to a few others I have come across.

    Have fun Splunking!

    Want to learn more about hiding rows or panels in Splunk dashboards? Contact us today!

  • The 7-Point Checklist for Integrating Splunk Observability Cloud into Your AWS Environment

    The 7-Point Checklist for Integrating Splunk Observability Cloud into Your AWS Environment

    So, you have decided that it is time to say goodbye to outdated legacy monitoring systems. You are tired of relying on systems that only analyze samples of data. Ones that cannot keep up with the speed of your AWS environment (those containers do spin up and spin down quickly after all). It is time to embrace a new solution that can provide your team with the critical insights and support needed to promptly identify, triage, and resolve behavioral abnormalities – Splunk Observability Cloud.  

    If your team has been contemplating an observational methodology, we encourage you to commit. The longer you wait to integrate a tool like Splunk Observability Cloud into your AWS environment, the more likely you are to miss the critical information needed to quickly identify and resolve issues, which could directly impact your team’s performance and your company’s bottom line.  

    Positive performance can have a significant impact on your systems’ ability to convert end users into paying customers. A recent study found that decreasing page load time from eight (8) to two (2) seconds can increase conversion rates by as much as 74 percent. And on the other end of the spectrum, a critical application failure can cost between $500,000 and $1 million.  

    But before you start layering Splunk onto your AWS platform and recoding your software for observability, you need to get organized.

    The 7-Point Splunk Observability Cloud Success Checklist  

    At TekStream, we’ve had the privilege of assisting many organizations in implementing Splunk Observability Cloud. We know what it takes for a successful implementation, and our team of experienced professionals has put together a list of the seven must-haves of any successful Splunk Observability Cloud integration into AWS and accompanying on-premise systems.  

    1. Name Your Implementation Destination 

    Our number one piece of implementation advice? Start with the end in mind.  

    Think ahead to the results and insights that will have the most significant impact on your team and organization. Ask yourself questions like:  

    • – What aspect of your business would benefit from observability? 
    • – What processes do you need to have visibility into? 
    • – What would the business benefit be if you had that information today? 
    • – What information do you need to be able to determine the health of those processes? 

    Observability is very much a purpose-driven methodology, similar to the DevOps methodology. If there is a specific result you are trying to achieve through observability, then you need to integrate observability in a way that aligns with those goals.  

    Identify your desired end-state, then work backwards to develop your implementation plan.  

    2. Understand What Must Change to Prepare Your Organization for Observability 

    Look at your current system and identify what changes you’ll need to make to become observability-ready.  You undoubtedly will have to make some changes to your code to support Splunk Observability Cloud. But code is not the only thing that may need to change.  

    Existing processes, response protocols, and even team mindsets are all aspects of your organization that will need to evolve to embrace observability. Lay out a plan for how you will introduce observability and earn team buy-in before you think about implementing Splunk Observability Cloud.  

    3. Determine Who in Your Organization Needs to Be Involved in The Implementation 

    Yes, your developers will be involved. However, successful Splunk Observability Cloud implementation goes beyond any individual developer. Everyone involved in supporting the business process should be part of the transformation, including site reliability engineers (SREs), DevOps engineers, leadership, and more.  

    Create a list of these individuals and match them to the specific implementation tasks needed for a successful integration. Be sure to include executive sponsorship and leadership support as well as who will be managing the project. Use this list to identify any gaps or overlaps in responsibilities.

    4. Identify Any Third-Party Systems That Need to Be Considered  

    Your first-party systems are not the only technologies that may need to be updated. If your organization uses any third-party tool, you will want to ensure those systems also are integrated into your observability platform.  

    Start with an audit of your third-party systems. Be sure to consider the limitations and supporting framework of each platform. Is it possible to integrate the current third-party system with Splunk Observability Cloud? Is it necessary?  

    Once you complete your assessment, affirm that your timeframe and roadmap align with your findings. You may need to account for additional time, support, or resources.   

    Additional Consideration: To accurately assess the ease of integration of your third-party tools, you may need to ask your vendors for additional access to the system. Check with each third-party platform to see if you have an opportunity to peek under the hood and gain insight into their system.  

    5. Put Together a Clear Implementation Timeframe 

    Do you have a specific end-time that your observability platform must be operational?  

    Of course, nearly every organization will say, “as soon as possible.” However, we believe that a successful timeframe considers the scope of the implementation lift as well as the resources your organization can allocate.  

    Align your timeframe directly to your roadmap by including sub-goals, milestones, deliverables, and other accountability metrics. Not only will this help you understand if your ideal timeline is too aggressive for the scope of the endeavor, but it also will help your team determine if additional resources are needed to complete the project within the desired timeframe.  

    6. Clarify a Specific Approach to Your Implementation 

    How are you planning on rolling out Splunk Observability Cloud? Are you only adding observability to new code? Are you rolling out one application or process at a time? Are you recoding all technologies before implementing them across your entire AWS environment?  

    Some of these implementation options may be more practical and useful than others. Take the time to investigate the feasibility and bottom-line impact of each approach. Do not get distracted recoding systems that will not help your organization reach its performance monitoring goals.  

    7. Choose an Implementation Partner

    If the above sounds daunting, know that you do not have to go it alone. The right partner will guide your team through each of these points, lending their proven experience and process to better ensure a successful Splunk Observability Cloud implementation.  

    At TekStream, we work with our clients to form a complete understanding of their observational goals, as well as the systems and processes that will need to be updated to achieve the desired outcome.  

    From there, we will develop a timeline and implementation roadmap that takes you from where you are today to where you want to be with observability. Along the way, we will provide our strategic recommendations and insights across several project aspects that are imperative to a successful AWS integration

    Get Started Today 

    Ready to abandon your legacy monitoring tools in favor of a system that can keep up with the ephemeral nature of AWS? We can help. TekStream has proven experience assisting companies with their adoption of observability. Our team of dedicated experts stands ready to offer our support. Together, we will craft an implementation strategy that aligns directly with the needs of your team. Reach out to us today to get started. 

    Interested in learning more about observability and how Splunk Observability Cloud can help you monitor and improve your AWS platform? Download our latest eBook:

    The essential guide to observability: How to Leverage AWS and the Splunk Observability Suite to Improve Your DevOps Performance.

  • Unlock Observability: 3 Ways Splunk Observability Cloud Works with AWS to Improve Your Monitoring Capabilities

    Unlock Observability: 3 Ways Splunk Observability Cloud Works with AWS to Improve Your Monitoring Capabilities

    According to the numbers, there are over 1,000,000 active AWS customers. In fact, there is a good chance that, like Netflix, Facebook, and LinkedIn, you, too, are using Amazon Web Services to support all or a portion of your cloud-based platforms and systems. Cloud technologies like AWS provide a host of benefits including scalability, cost-efficiencies, and reliability. But the very nature of cloud processing also introduces new layers of complexity. One critical added complexity is in monitoring cloud systems to identify and resolve issues. Traditional alert monitoring tools were not designed to address the ephemeral nature of cloud processing.  

    Fortunately, Splunk has brought a full observability suite to market that integrates seamlessly with AWS’s portfolio of services to provide AWS users and their DevOps teams with the tools they need to improve the performance of their cloud-based systems. Below, we have laid out a brief primer on observability and paired that overview with three ways that the Splunk Observability Cloud works with AWS to streamline your monitoring.  

    Introduction to the Splunk Observability Cloud 

    While there is no shortage of observability tools on the market, Splunk’s acquisition of SignalFX in 2019, its subsequent additions to the platform, and its existing AWS integrations make it a powerful choice for organizations that use AWS as well as other leading cloud solutions like Microsoft Azure and Google Cloud Platform.  

    Splunk offers a fully integrated observability set of products designed to bring all metric, trace, and log telemetry into a single source of data truth. Additionally, you can seamlessly merge this data with other Splunk Enterprise data such as security, IT and DevOps for the most comprehensive and integrated view of your environment. 

    The Splunk Observability Cloud is comprised of several monitoring and observability products, including:   

    • – Splunk Infrastructure Monitoring: AI-driven infrastructure monitoring for hybrid or multi-cloud environments.  
    • – Splunk APM: NoSample™ full-fidelity application performance monitoring and AI-driven directed troubleshooting. 
    • – Splunk On-Call: Incident response and collaboration.   
    • – Splunk RUM (coming soon): Works with Splunk APM to provide end-to-end full-fidelity visibility by providing metrics about the actual user experience as seen from the browser. 
    • – Splunk Log Observer: Built specifically for SREs, DevOps engineers, and developers who need a logging experience that empowers their troubleshooting and debugging processes. 

    Three Benefits of Integrating Splunk Observability Cloud with AWS 

    For organizations already using AWS, Splunk works seamlessly with Amazon to provide DevOps teams with out-of-the-box visibility across their complete AWS environment.  With Splunk Observability Cloud, all data is shown within a single system, making it easy for your team to identify issues across any of the AWS tools you utilize.  

    As data passes from your AWS services into your Splunk environment, it is analyzed in real time across the full Splunk Observability Cloud. The result is comprehensive reporting and monitoring that allows you to identify and respond to issues the moment they occur – regardless of your platform’s size. 

    A Venn-diagram style graphic displaying the features of AWS and Splunk.

    While there are several efficiencies and benefits to be gained by layering Splunk Observability Cloud onto your AWS environment, here are three that stick out to our team:  

    1. Global Monitoring of Amazon Container Services 

    Splunk’s Infrastructure Monitoring tool (part of the Observability Cloud) is built to specifically monitor the ephemeral and dynamic nature of container environments. Through this tool, customers can have key insight into Amazon ECS and Amazon EKS performance characteristics and containerized applications.  

    Out-of-the box dashboards and reporting provide teams with the information they need to capture immediate value from the platform.  

    2. Real-time Fidelity Tracing 

    Are you tired of having to sample data or work with limiting data ingestion caps? Splunk Observability Cloud includes two powerful tools that, together with AWS, provide teams with end-to-end full-fidelity tracing. 

    First, Splunk APM utilizes OpenTelemetry-enabled instrumentation to ingest all trace data. No more sampling. Splunk APM captures, analyzes and stores 100% of available trace data. Once captured, Splunk Real User Monitoring (RUM) can tie that trace data to specific user actions within your AWS environment.  

    These systems work in tandem to provide your team with rich visibility into the bugs and bottlenecks that could harm your user experience.  

    3. Automated Incident Response 

    Not only does Splunk Observability Cloud provide real-time visibility across your complete cloud stack, but it also can reduce your team’s mean time to recovery (MTTR) through automated responses. Through the platform, DevOps teams can set automated remediations that fire regardless of human oversight.  

    Built-in artificial intelligence and machine-learning capabilities help further improve the efficiency and latency of automated responses.  

    Enhance Your AWS Platform with Splunk Observability Cloud 

    If your legacy monitoring systems cannot keep up with the complexities and intricacies of AWS, it’s time to make a shift in your team’s mindset towards observability. By making the structural changes necessary to facilitate observability and embracing robust tools like Splunk Observability Cloud, your team will gain the capacity to improve the performance of your AWS environment.  

    Interested in learning more about observability and how Splunk Observability Cloud can help you monitor and improve your AWS platform? Download our latest eBook:

    The essential guide to observability: How to Leverage AWS and the Splunk Observability Suite to Improve Your DevOps Performance.

  • TekStream Recognized in 2021 Splunk Global and Regional Partner Awards

    TekStream Recognized in 2021 Splunk Global and Regional Partner Awards

    TekStream Named 2021 Global Services Partner of the Year and AMER Professional Services Partner of the Year for Outstanding Performance

      TekStream today announced it has received the 2021 Global Services Partner of the Year and 2021 AMER Professional Services Partner of the Year awards for exceptional performance and commitment to Splunk’s Partner+ Program. The 2021 Global Services Partner of the Year Award recognizes a partner with excellence in post-sale and professional services implementations. This partner demonstrates a strong commitment to technical excellence, certifications, and customer satisfaction. The 2021 AMER Professional Services Partner of the Year Award recognizes an AMER Splunk partner that is actively engaged in services implementations, in addition to having a strong commitment to training and certification of their organization. For more information on Splunk’s Partner+ Program, visit the Splunk website. “We are delighted to have won the 2021 Global Services Partner of the Year and 2021 AMER Professional Services Partner of the Year awards. It is a fantastic achievement to be awarded and even more satisfying to contribute to the success of Splunk and our customers. Our team is very excited to be recognized for its efforts and expertise and will wear this prized recognition proudly,” said Matthew Clemmons, Managing Director at TekStream. “Congratulations to TekStream for being named the 2021 Splunk Global Services Partner of the Year and 2021 AMER Professional Services Partner of the Year,” said Bill Hustad, VP, Global GTM Partners, Splunk. “The 2021 Splunk Global Partner Awards highlight partners like TekStream that deliver successful business outcomes, as well as help our joint customers leverage Splunk’s Data-to-Everything Platform to drive value and unlock insights. Additionally, TekStream shares our commitment of prioritizing customer success.” The Splunk Partner Awards recognize partners of the Splunk ecosystem for industry-leading business practices and dedication to constant collaboration. All award recipients were selected by a group of Splunk executives, thought leaders, and the global partner organization. “We are very honored to have been selected by Splunk for not just one, but two Partner of the Year awards. TekStream prides itself on doing what is right for the customer above all else, and our commitment to that mantra drives everything that we do. We value our partnership and look forward to helping Splunk grow the ecosystem on its way to $5B,” said Karl Cepull, Senior Director, Operational Intelligence at TekStream. About TekStream TekStream accelerates clients’ digital transformation by navigating complex technology environments with a combination of technical expertise and staffing solutions. We guide clients’ decisions, quickly implement the right technologies with the right people, and keep them running for sustainable growth. Our battle-tested processes and methodology help companies with legacy systems get to the cloud faster, so they can be agile, reduce costs, and improve operational efficiencies. And with 100s of deployments under our belt, we can guarantee on-time and on-budget project delivery. That’s why 97% of clients are repeat customers. For more information visit https://www.tekstream.com/.
  • JSON Structured Data & the SEDCMD in Splunk

    JSON Structured Data & the SEDCMD in Splunk

    By: Khristian Pena | Splunk Consultant

     

     

    Have you worked with structured data that is not following its structure? Maybe your JSON data has a syslog header. Maybe your field values have an extra quote, colon, or semicolon and your application team cannot remediate the issue. Today, we’re going to discuss a powerful tool for reformatting your data so automatic key-value fields are extracted at search-time. These field extractions utilize KV_MODE in props.conf to automatically extract fields for structured data formats like JSON, CSV, and from table-formatted events.

    Props.conf

    [<spec>]

    KV_MODE = [none|auto|auto_escaped|multi|json|xml]

    This article will focus on the JSON structure and walk through some ways to validate, remediate and ingest this data using the SEDCMD.  You may have used the SEDCMD to anonymize, or mask sensitive data (PHI,PCI, etc) but today we will use it to replace and append to existing strings.

     

    JSON Structure

    JSON supports two widely used (amongst programming languages) data structures.

    • A collection of name/value pairs. Different programming languages support this data structure in different names. Like object, record, struct, dictionary, hash table, keyed list, or associative array.
    • An ordered list of values. In various programming languages, it is called as array, vector, list, or sequence.

    Syntax:

    An object starts with an open curly bracket { and ends with a closed curly bracket } Between them, a number of key value pairs can reside. The key and value are separated by a colon : and if there are more than one KV pair, they are separated by a comma ,

    {

      “Students“: [

                                          { “Name“:”Amit Goenka” ,

      “Major“:”Physics” },

                                          { “Name“:”Smita Pallod” ,

      “Major“:”Chemistry” },

                                          { “Name“:”Rajeev Sen” ,

      “Major“:”Mathematics” }

                                          ]

                                          }

     

    An Array starts with an open bracket [ and ends with a closed bracket ]. Between them, a number of values can reside. If more than one values reside, they are separated by a comma , .

    [

                                          {

      “name“: “Bidhan Chatterjee”,

      “email“: “[email protected]”

                                          },

                                          {

      “name“: “Rameshwar Ghosh”,

      “email“: “[email protected]”

                                          }

                                          ]

     

    JSON Format Validation:
    Now that we’re a bit more familiar with the structure Splunk expects to extract from, let’s work with a sample. The sample data is JSON wrapped in a syslog header. While this data can be ingested as is, you will have to manually extract each field if you choose to not reformat it. You can validate the structure by copying this event to https://jsonformatter.curiousconcept.com/ .

    Sample Data:

    May 14 13:28:51 <redacted_hostname> github_audit[22200]: { “above_lock_quota”:false, “above_warn_quota”:false, “babeld”:”eebf1bc7″, “babeld_proto”:”http”, “cloning”:false, “cmdline”:”/usr/bin/git upload-pack –strict –timeout=0 –stateless-rpc .”, “committer_date”:”1589477330 -0400″, “features”:” multi_ack_detailed no-done side-band-64k thin-pack include-tag ofs-delta agent=git/1.8.3.1″, “frontend”:”<redacted>”, “frontend_pid”:17688, “frontend_ppid”:6744, “git_dir”:”/data/user/repositories/7/nw/75/42/9d/4564/6435.git”, “gitauth_version”:”dcddc67b”, “hostname”:”<redacted>”, “pgroup”:”22182″, “pid”:22182, “ppid”:22181, “program”:”upload-pack”, “quotas_enabled”:false, “real_ip”:”10.160.194.177″, “remote_addr”:”127.0.0.1″, “remote_port”:”15820″, “repo_config”:”{“ssh_enabled”:”true”,”ldap.debug_logging_enabled”:”true”,”auth.reactivate-suspended”:”true”,”default_repository_permission”:”write”,”allow_private_repository_forking”:”true”}”, “repo_id”:6435, “repo_name”:”<redacted>”, “repo_public”:true, “request_id”:”43358116096ea9d54f31596345a0fc38″, “shallow”:false, “status”:”create_pack_file”, “uploaded_bytes”:968 }

     

    The errors are noted and highlighted below:

    As we can see, the timestamp, hostname and thread field are outside of the JSON object.

    Screenshot of a JSON validation tool showing syntax errors including multiple JSON root elements and invalid numbers, highlighting improperly structured event data.

     

    Replace strings in events with SEDCMD

    You can use the SEDCMD method to replace strings or substitute characters. This must be placed on the parsing queue prior to index time. The syntax for a sed replace is:

    SEDCMD-<class> = s/<regex>/1<replacement>/flags

    • <class> is the unique stanza name. This is important because these are applied in ABC order
    • regexis a Perl language regular expression
    • replacementis a string to replace the regular expression match.
    • flagscan be either the letter g to replace all matches or a number to replace a specified match.
    • 1 – use this flag to insert the string back into the replacement
    Side-by-side comparison of raw log format vs. structured JSON format, showing key fields like timestamp, hostname and thread, along with a sample props.conf configuration using SEDCMD for field extraction.

     

    How To Test in Splunk:

    Copy the data sample text into a notepad file and upload using Splunk’s built in Add Data feature under Settings to test. Try out each SEDCMD and note the difference in the data structure for each attribute.

    BEFORE:

    Raw log data showing a GitHub audit entry without JSON formatting, including metadata such as hostname, thread and git upload details.

    AFTER:

    Structured JSON log showing extracted fields including timestamp, hostname and thread, enabling easier data indexing and querying in Splunk.

    Props.conf – Search Time Field Extraction

    [<spec>]

    KV_MODE = json

    Compact JSON object visualized with expanded field grouping, displaying hostname, thread name and timestamp parsed cleanly, reflecting successful JSON ingestion.

     

    Want to learn more about JSON structured data & the SEDCMD in Splunk? Contact us today!

  • Splunk KvStore Migration

    Splunk KvStore Migration

    By: Christopher Winarski | Splunk Consultant and

    Bruce Johnson | Director, Enterprise Security

    Migrating your Splunk environment can be a daunting task to some. With the worry of missing valuable data. Did my users’ settings migrate properly? Did all my applications migrate properly? Did all my lookup tables survive the migration? If you find yourself performing a Splunk migration you may be asking yourself some of these questions. Well, today I try to take one of those worries off your chest by walking you through a Splunk KvStore Migration, more specifically migrating the Splunk KvStore from a Search Head Cluster to a new Search Head Cluster. E.g On-prem Shcluster to AWS Shcluster

    KvStore stores data in key-value pairs known as Collections. These tables of data are located in your collections.conf files. Records contain each entry of your data, similar to a row in a database table. Using KvStore as opposed to csv files you can define the storage definition schema for your data, perform create-read-update-delete operations on individual records using Splunk REST API and lookups using the Splunk search language. KvStore excels in performance when you start getting large lookups with many data points which is especially prevalent within Enterprise Security, one of Splunk’s Premium Apps.

    The normal export/migration is to use csv export which is not really practical for large KvStores due to the limitations to file sizes on most operating system’s is what drive was used for mongodb in the first place. Gemini KvStore Tools helps to circumvent the normal semi-workable, tedious migration process.

    Gemini KV Store Tools comes with some custom commands built for the Splunk search bar that makes our life/migration less complicated. The commands we are interested in for this migration are:

    • | Kvstorebackup
    • | Kvstorerestore

    Requirements for this process:

    • You must already be utilizing Splunk’s KvStore for your lookups.
    • Downloaded and installed “Gemini KV Store Tools” application in both the originating environment Search Head Cluster and the new environment Search Head Cluster you are migrating too. https://splunkbase.splunk.com/app/3536/
    • You must have already migrated/copied the applications from the old Search Head Cluster. We are interested in the collections.conf within these applications.
      • tar -zcf apps.tgz /opt/splunk/etc/shcluster/apps
    • The collections.conf files must be present on the new environment before proceeding

    Step 1: Of the original Search Head Cluster, Identify the kvstore captain, and log into the GUI environment, then open the search app. The KvStore captain is the instance in the search head cluster that receives the write operations regarding the KvStore collections where the Search head captain is the instance in the search head cluster that schedules jobs, pushes knowledge bundles to search peers, and replicates any runtime changes to knowledge objects throughout the search head cluster.**note** This may be different than the Search Head captain

    Step 2: On this instance, also log into the backend and create a directory under the /tmp directory named “kvstore_backup”. Ensure Splunk has read/write permissions to this folder.

    cd /tmp

    mkdir kvstore_backup

    sudo chown -R splunk:splunk /tmp/kvstore_backup

    Step 3: Creates a json file per each collection to the destination path in the kvstore_backup folder, as well as should see “Success” per each collection zipped within the original environment. In the search bar on original environment KvStore captain, run:

    | kvstorebackup path=”/tmp/kvstore_backup” global_scope=”true” compression=”true”

    Splunk search results showing successful KVStore backup operations across multiple apps and collections, including file paths and timestamps.

    Step 4: Check KvStore monitoring console to verify if collection counts are listed and save the page to refer to the results/counts to verify later. (old environment)

    Monitoring Console > Search > KvStore:Instance

    Dropdown menu in Splunk UI highlighting KV Store: Instance under the Search section for monitoring KVStore-related activity.

    Step 5: Now that you have created your collection backups and have verified that the number of records per is correct. Go on each new search head cluster member (CLI) and edit server.conf to have:

    [kvstore]

                                                                            oplogSize = 10000

    Also, on each instance, you have to edit/change the search head replication factor to 1 in the new environment on each search head cluster member. (server.conf)

    [shclustering]

    replication_factor = 1

    Once both are set, restart the instance. Do this for every search head cluster member in the new environment.

    Step 6: Identify and get Search Head captain to be the same instance as the kvstore captain.

    Ensure the kvstore captain = Search Head Cluster captain.

    Useful commands:

    ./splunk show shcluster-status

    ./splunk show kvstore-status

    Transfer captaincy to one node by bootstrapping the kvstore captain as the search head captain.

    On the KvStore captain, we want to make it also the search head captain, run this command (CLI):

    ./splunk edit shcluster-config -mode captain -captain_uri <URI>:<management_port> -election false

    On each other non-captain instance, run this command (CLI):

    ./splunk edit shcluster-config -mode member -captain_uri <URI>:<management_port> -election false

    This will allow you to specify the captain as the kvstore captain and get rid of dynamic captaincy for this purpose. At the end we will want to revert our search head cluster back to a dynamic captaincy.

    Step 7: Once you have the kvstore captain = search head captain, Log into the CLI of the other search head nodes (every search head cluster member that is not the captain/kvstore captain). Starting the instance after cleaning the local kvstore will initialize a kvstore synchronization upon startup with kvstore captain.

    SHUTDOWN Splunk: ./splunk stop

    run: ./splunk clean kvstore –local

    Then start splunk: ./splunk start

    Step 8: SCP kvstore_backup from Step:2 to new environment search head captain/kvstore captain. Make sure that splunk has permissions to access the file. Follow these steps for guidance.

    Old instance where the backup was created from:

    scp -r kvstore_backup ec2-user@IPADDRESS:/tmp

    Move file to /opt folder on kvstore/search head captain:

    mv kvstore_backup /opt/kvstore_backup

    Change ownership of the file and internal files to splunk for permissions

    sudo chown -R splunk:splunk /opt/kvstore_backup

    Step 9: Kvstore Gemini Tools is to be installed on the new search head cluster prior to running this step, if you have not done so please insure it is installed within the new search head cluster. Once the kvstore_backup has the permissions and is in place on the backend of the kvstore captain/search head captain. Now log on to the GUI of that splunk instance, open search and run:

    | kvstorerestore filename=”/opt/kvstore_backup/*.json.gz”

     Splunk search displaying results from a KVStore restore operation, showing restored JSON files and associated apps with success status.

    On big restores, can take many minutes for the restore to complete, be patient and let the search run.

    Step 10: Verify lookups return the same results in the new environment as back in the old environment with the saved page(step 4) , run:

    | inputlookup <Lookup definition>

    Splunk statistics view showing geo_countries lookup data from KVStore, including feature names and complex geolocation JSON structures.

     

    Step 11: We want to revert the search head cluster back to a dynamic captaincy now (the static captaincy bootstrapping was just used for the migration) and also change our replication factor back to the original setting in the environment.

    You can do this by logging on to each instance CLI, stopping splunk then on the search head cluster captain, run:

    ./splunk edit shcluster-config -mode captain -captain_uri <URI>:<management_port> -election true

    On the other non captain search head cluster members run:

    ./splunk edit shcluster-config -mode member -captain_uri <URI>:<management_port> -election true

    Then we want to edit the config file again to revert replication factor back to the original number that was set before the migration. (server.conf)

    [shclustering]

    replication_factor = 2

    **The “2” is arbitrary here, as this should be set to the number that was present prior to the migration**

    That’s it! Migrations can be a scary endeavor and if not prepared, one can easily lose data. If you seek further assistance don’t hesitate to reach out to us here at TekStream Solutions. We would be happy to help! No Splunk project is too small or too big.

  • How to Set Up Splunk DB Connect to Connect to Multiple MSSQL Databases and Some Tips & Tricks

    How to Set Up Splunk DB Connect to Connect to Multiple MSSQL Databases and Some Tips & Tricks

    By: Jon Walthour |Team Lead, Senior Splunk Consultant

    Over the years, I have found one tried and true method for getting Splunk connected to multiple Microsoft SQL Server instances spread across a corporate network—connect to Windows from Windows. That is to say, run the DB Connect application from Splunk on a Splunk Enterprise Heavy Forwarder, installed on a Windows environment. Why must Splunk be running Windows? It certainly doesn’t if you’re going to authenticate to the MSSQL instances with local database accounts. That authentication process can be handled by the database driver. However, when multiple connections to multiple MSSQL instances are required, as is often the case, a bunch of local account usernames and passwords can be a nightmare to manage for everyone involved. So, Windows AD authentication is preferred. When that becomes a requirement, you need a Windows server running Splunk. I tried getting Splunk running on Linux to connect to SQL Server using AD authentication via Kerberos for a month and never got it to work. Using a Windows server is so much simpler. To accomplish this, the first thing you need to do is request two things from your Infrastructure teams—a service account for Splunk to use to connect to all the SQL Server instances and a server running Microsoft Windows. The service account must have “logon as a service” rights and the Windows server must meet the requirements for Splunk reference hardware with regards to CPUs, memory and storage. The best practice for Splunk generally speaking is to use General Policy Objects (GPOs) to define permissions so that they are consistent across a Windows environment. Relying on local Admin accounts can result in challenges, particularly across some of the “back-end” Splunk instances such as Splunk Search Head to Indexer permissions. Once the server and service account have been provisioned, install Splunk Enterprise and Splunk DB Connect (from Splunkbase) on the it. Here’s the first trick: go into Settings > Control Panel > Services and configure the splunkd service to run under the service account. This is crucial. You want not just the database connections to be made using the service account, but the Splunk executables to be running under that account. This way, all of Splunk is authenticated to Active Directory and there are no odd authentication issues. After you have Splunk running under the MSSQL service account with DB Connect installed as an app in the Splunk instance, you’ll want to install the Java Runtime Environment (JRE) software, either version 8 (https://www.oracle.com/java/technologies/javase-jre8-downloads.html) or version 11 (https://www.oracle.com/java/technologies/javase-jdk11-downloads.html), and download the appropriate MSSQL driver based on Splunk’s documentation (https://docs.splunk.com/Documentation/DBX/latest/DeployDBX/Installdatabasedrivers), which either the Microsoft drivers for the open source jTDS drivers. Personally, I’ve had better outcomes with the Microsoft drivers in this scenario. Once you’ve downloaded the SQL database driver archive, unzip it. In the installation media, find the library “mssql-jdbc_auth-<version>.<arch>.dll” appropriate to the version and architecture you downloaded and copy it to the C:WindowsSystem32 directory. Then, find the file jar “mssql-jdbc-<version>.<jre version>.jar” appropriate to your JRE version and copy it to $SPLUNK_HOMEetcappssplunk_app_db_connectdrivers. Now, log into Splunk and go the Splunk DB Connect app. It will walk you through the configuration of DB Connect. In the “General” section, fill in the path to where you installed the JRE (JAVA_HOME). This is usually something like “C:Program FilesJavajre<version>”. The remaining settings you can leave blank. Just click “Save”. This will restart the task server, which is the java-based processing engine of DB Connect that runs all the database interactions. In the “Drivers” section, if the MS SQL drivers are not listed with green checkmarks under the “Installed” column, click the “Reload” button to have the task server rescan the drivers folder for driver files. If they still do not have green checkmarks, ensure the right driver files are properly placed in $SPLUNK_HOME/etc/apps/splunk_app_db_connect/drivers. Next, navigate to Configuration > Databases > Identities and click “New Identity”. Enter the username and password of the service account you’re using for the MSSQL connections and give it an appropriate name. Check “Use Windows Authentication Domain” and enter the appropriate value for your Active Directory domain. Save the identity. Navigate to Configuration > Databases > Connections and click “New Connection”. Pick the identity you just created and use the “MS-SQL Server using MS Generic Driver With Windows Authentication” connection type. Select the appropriate timezone the database you’re connecting to is in. This is especially important so that Splunk knows how to interpret the timestamps it will ingest in the data. For the “host” field, enter the hostname or IP address of the MSSQL server. Usually the default port of 1433 doesn’t need to be changed nor the default database of “master”. Enable SSL if you’re connection is to be encrypted and I always select “Read Only” when creating a database input to make sure there is no way to input can change any data in the connected database. Finally, a few miscellaneous tips for you. For the “Connection Name” of database connections, I always name them after their hostname and port from the JDBC URL Settings. This is because in a complex DB Connect environment, you can have many inputs coming from many different databases. A hostname/port number combination, however, is unique. So, naming them with a pattern of “hostname-port#” (e.g., “sql01.mycompany.com-1433”) will prevent you from establishing duplicate connections to the same MSSQL installation. Another tip is that you can edit the connection settings for your JDBC driver directly in the configuration. This is typically only useful when your development team has come up with specific, non-standard configurations they use for JDBC drivers. Sometimes complex database queries that call stored procedures or use complex T-SQL constructions can be more than the JDBC driver and Task Server can handle. In that case, I ask the MSSQL DBAs if they will create a view for me constructed of the contents of the query and provide me select rights on the view. That leaves all the complex query language processing with SQL server rather than taxing the driver and DB Connect. When dealing with ingesting data from a SQL server cluster, the usual construction of the JDBC connection string created by DB Connect won’t do. With a clustered environment, you also need to specify the instance name in addition to the hostname and port of the SQL Server listener. So, after setting up the connection information where the host is the listener and the port is the listener port, click the “Edit JDBC URL” checkbox and add “;instance=<database instance name>” to the end of the JDBC URL to ensure you connect to the proper database instance in the cluster. For example, the get to the “testdb” instance in the “sql01” cluster, you’d have a JDBC URL like: “jdbc:sqlserver://sql01.mycompany.com:1433;databaseName=master;selectMethod=cursor;integratedSecurity=true;instance=testdb” I hope these directions and tips have been helpful in making your journey into Splunk DB Connect simpler and straightforward. Happy Splunking! Want to learn more about setting up Splunk DB Connect to connect to multiple MSSQL databases? Contact us today!
  • Creating Splunk Alerts (and Setting Permissions!) Through REST API

    Creating Splunk Alerts (and Setting Permissions!) Through REST API

    By: Marvin Martinez | Senior Developer

     

    Creating Alerts via the Spunk REST API is fairly straightforward once you know exactly what parameters to use to ensure that Splunk recognizes the Saved Search as an Alert.  The same applies for ACL permissions on these alerts and other Splunk Knowledge Objects.

    First things first, let’s create a scheduled search via REST using the “/services/saved/searches” endpoint.  The curl code below creates a simple search to pull some data from the _internal index for the last 10 minutes.

    Screenshot of a curl command using the Splunk REST API to create a saved search, showing authorization header and search parameters.

    Note that, to create the saved search, all that was needed was authorization (a token in this case) and a couple of parameters in the call: (1) a name for the search and (2) the search itself.

    This will create a search in the Searches, Reports and Alerts screen in Splunk Web.

    Splunk UI displaying a newly created saved search under the Searches, Reports and Alerts tab with actions available for editing and running.

    As you can see, the search has been created and shows up as a Report.  But what if you need this to be an alert?! Even more importantly, what if you want to set this up with specific permissions?  Well, luckily, like essentially everything else in Splunk, this can also be done via the REST API.

    To create a new search as an alert, you’ll need to call the same endpoint as shown above with the parameters mentioned below. Otherwise, call the “/services/saved/searches/{name}” endpoint if you’re modifying a search that’s already created.  For the purposes of this write-up, I will call the endpoint to manage an already created search (“/services/saved/searches/{name}”).

    In order for Splunk to recognize the search as an alert, and not a Report, the following parameters have to be set correctly and passed along in your POST REST call.  The table below outlines the parameter name and a brief description of what they mean.

    ParameterDescription
    alert_type‘number of events’ (if this is set to ‘always’, which is the default, Splunk thinks it’s just a report)
    is_scheduledtrue (this is a Boolean setting that Splunk checks to make sure there’s a set schedule for the report, which is required for alerts)
    cron_schedule*/10 * * * * (a cron schedule that represents the schedule which the alert will run on)
    alert_comparator‘greater than’ (this is the operator used in the alert settings to determine when to send the alert – associated with the alert_threshold below)
    alert_threshold0 (this is the number to compare with the operator above. i.e. only alert when results > 0)

     

    The curl command for the REST call is shown below.  Note the aforementioned parameters that are now being included.

    Curl command example for configuring a Splunk alert via REST API, including scheduling, threshold and alert type settings.

    But how does this search now look in the Searches screen?  As can be seen in the image below, once the REST command has been executed successfully, your Alert should now be reflected appropriately as an “Alert”.

    Updated Splunk interface showing that the saved search has been converted to an alert, with a defined next scheduled time.

    For further confirmation of these settings, click the Edit link under Actions, and click Advanced Edit from the drop-down menu.  This will bring up a lengthy listing of all the settings for this search.  If using the REST API is not your style, this is where you can alternately set these settings from Splunk Web.

    Splunk UI dropdown menu under the Edit button displaying options like Edit Alert, Disable, Clone and Advanced Edit for a saved alert.

    The listing looks something like this:

    Settings panel showing detailed alert action parameters including email configuration, authentication and formatting for alerts.

    All that’s left now is to set your permissions as desired.  To do this, you’ll need to call a new endpoint.  You’ll use the previous endpoint you used to manage a specific saved search, but you’ll add a new section at the end for “acl” (i.e. ‘https://localhost:8089/services/saved/searches/ATestRESTSearch/acl’).  This acl extension/option is available for any endpoint but, in this use case, we’ll use it to manage the permissions for the alert we created above.

    In the case of a saved search, you’ll need to include the following parameters in your REST call:

    ParameterDescription
    sharing‘app’ – this can also be ‘global’ or ‘user’, depending on what the scope of the access you want this search to have (This is required when updating the ACL properties of any object)
    app‘search’ – this is the name of the app that this search belongs to.  (For saved searches, this is required when updating ACL properties of these objects)
    perms.readA comma-delimited list indicating what roles to assign read permissions to
    perms.writeA comma-delimited list indicating what roles to assign write permissions to

     

    A curl command that was used in this case is shown below.  In this example, the alert is being updated to give read permissions to admin and user-mmtestuser1.  Additionally, it is being updated to give write permissions to admin and power roles.

    Example curl command using the Splunk REST API to set permissions on a saved search, specifying sharing level, read and write access roles for users and admin.

    As an added bonus, here is an example of how Postman was leveraged to make this final call, in case that’s your REST API-calling tool of your choice.  The Authorization tab, in this example, was set to Basic Auth type with admin credentials.  In the Body tab, you’ll set your parameters to the REST call as “x-www-form-urlencoded” values.  Note the 4 parameters mentioned above shown included in the call below.

    Postman interface showing a successful POST request to update permissions for a saved search in Splunk, with XML response displayed.

    Once the REST call is made, navigate to your “Searches, Reports, and Alerts” screen in Splunk Web, and click to Edit Permissions of your alert.  You’ll notice that your permissions are now reflected just the way you designated them in your REST call.

    Splunk permission editor modal for a specific alert, with read/write access options for different user roles and a save button.

    The Splunk REST API is a great alternative, and a necessity for many, to using Splunk Web to create and manage knowledge objects.  Anything that can be done in Splunk Web can be done via the REST API, though it sometimes can be a bit hard to easily understand the process for how to achieve some of these desired actions.  Now, you can easily create alerts and set the permissions just the way you want…and all through REST!

    Want to learn more about creating alerts via the Spunk REST API? Contact us today!

     

  • Using an External Application to Pull Splunk Search Results

    Using an External Application to Pull Splunk Search Results

    By: Aaron Dobrzeniecki | Splunk Consultant

    Have you ever wanted to pull logs from Splunk without actually being physically signed into the Splunk Search Head? With an external application, such as Postman, you can query the Splunk REST API endpoint to actually provide you with results from a search being run.

    When Splunk runs a search, it creates a search ID which we can use to grab the results from the REST endpoint. We will be testing out two ways to get the results of a search. The first way is to grab the name of the Splunk search and query it against the /services/saved/searches/{search_name}/dispatch endpoint, which will provide us with the sid. We then use the sid to grab the results of the search, which will fire off the search and will poll for results as they come in. The second way to get the search results is by doing an export on the search name which will run the search and get the results without polling.

    First things first, you need to make sure that the user you are authenticating to Splunk with has the “Search” capability, as well as access to search the necessary indexes. It’s that simple! If you are setting up a user for a particular person make sure they only have access to what they need. Giving further access is not necessary and can cause security issues.
    In this example we are using the Postman application to query the Splunk REST API to grab search results from a couple of different reports/saved searches. Things we are going to need include:

    • Splunk user account with the Search capability. We need that user to be able to search the index we are going to be grabbing our data from.
    • We also need to know the Splunk URL we are going to be pulling from. In this case, I am using my localhost as an example. We will also be querying the Splunk management port of 8089 to get our results set.
    Postman interface showing a POST request with basic authentication to dispatch a Splunk saved search.

    The image above shows the type of request I am doing (POST), the REST API being used to query my search ID (/services/saved/searches/{name_of_search}/dispatch), and the authentication type of username and password. What the URL above is doing is it is reaching out to Splunk and grabbing the SID (search id) of the search named Index Retention Getting Close. With this search id we will be able to run a GET on the Splunk REST API and grab the results of the search.

    Below I will be showing you two Splunk REST API endpoints that you can query (using POST) to get the Search ID for a specified search. The first endpoint is for searches that do not have Global permissions. As long as the user you are authenticating with has a role that has access to read the search, you can query the endpoint of /servicesNS/nobody/{app}/saved/searches/{name}/dispatch to retrive the Search ID. The second endpoint you can query if the search has Global permissions and you have read access is simply /services/saved/searches/{name}/dispatch to retrieve the Search ID. The two scenarios are below.

    Postman response panel displaying the returned SID from a dispatched Splunk search in XML format.

    The image above shows the rest endpoint that can be used to grab a specific search ID that is in an app and has specific permissions. As long as my account has access to the app and search inside the app, I will be able to query it. For this example, we have changed the permissions of the search to be App only.

    Postman interface showing a GET request to Splunk returning search job results in JSON format.

    The image above is the results of the search in json, using the search ID we queried from the REST API.

    Postman interface showing XML-formatted search results including index, status, and retention fields.

    The image above gives us the same results except they are in xml format.

    Postman response returning a different SID for a dispatched Splunk search, shown in XML format.

    The image above shows the search ID of the search with REST API I am querying. Since that search now has Global permissions, we do not need to use the ServicesNS endpoint. When you do a POST with a dispatch on the name of a search/report you will get the Search ID. As you can see the search ID is circled. We will be using this search ID to query the results of the search and show the actual search results in the Postman application. The Splunk REST API you will want to query next is the /services/search/jobs/{sid}/results?output_mode= (atom | csv | json | json_cols | json_rows | raw | xml). Any of those values will get you the results of the search in the format selected. In this example, I will be showing you json and xml.

    Postman displaying structured XML response for a Splunk index search, including yellow status and retention data.

    As you can see above, the data results are shown in xml format for the search we were wanting to get results from.

    Postman interface showing JSON-formatted Splunk results for multiple indexes, including “testsvc2” and “dreamcrusher.”

    This image shows the same results but in json format. With the options above for data output, you can query the Splunk REST API to get the search results and have them show in your preferred format.

    Way 2: Query the REST API to show the results by using an export on the search name which will run the search and get the results without polling. Take a look at the screenshot below which queries the /services/search/jobs endpoint to stream in the results of the search as they come in.

    Postman displaying a POST request to Splunk’s search/report endpoint, returning detailed XML event data from a specific index.

    Remember, you need to have the Search capability in Splunk, as well as you have to be able to read the results of the search. Whether that is setting Global permissions or having a role that has read access to the app and search. Below are some links referencing the Splunk REST API. If you have any questions at all regarding querying the Splunk REST API from an external application, please let me know!

    https://docs.splunk.com/Documentation/Splunk/8.0.6/RESTTUT/RESTsearches
    https://docs.splunk.com/Documentation/Splunk/8.0.6/RESTREF/RESTsearch#search.2Fjobs.2Fexport)

    Want to learn more about using an external application to pull Splunk search results? Contact us today!