Category: Splunk

  • TrackMe Setup: The three ways to create a tracker

    TrackMe Setup: The three ways to create a tracker

    By Tyler Phillips, Splunk Core Certified Consultant

    Today’s blog is about an app I was recently given to learn and it is a great app to use and keep track of data sources.  
     
    TrackMe is used to keep track of data ingestion and quality of that data. The way this app is configured, you can easily monitor thousands of data sources to make sure they are coming in consistently and be alerted when a data feed goes down. Using thresholds on delay and latency values means we not only can alert on how long we have gone without seeing data but we can alert when a data source takes too long to come into Splunk.  
     
    Today, I’ll show you how to get started with the three different ways to set up a data tracker in Trackme. These three are called Hybrid, Dedicated, and Shared.  

    Let’s start with the most useful tracker, the hybrid tracker. Hybrid trackers are used to auto-discover new entities that come from a data constraint. This allows us to look over a wide range of data and automatically create the entities for data sources.  
     
    We are going to start with a blank tenant. First click the “Manage: hybrid trackers” button in the tenant main screen.  
     

    TrackMe dashboard showing zero data sources in alert and zero unmonitored source.

    You will then see a pop-up where we name the tracker and set the root constraint. I decided to use the data I am collecting from my mac for this tracker. So, my root constraint is “index=mac sourcetype=*”.  

    TrackMe interface for creating a new hybrid tracker with index and sourcetype search constraints.

     
     
    That’s all we need to adjust for a quick start but here is a list of all the adjustable parameters for a tracker. 

    • Identifier: Assign a unique name to the tracker. 
    • Deployment Target: Specify whether the data is local or from a remote Splunk deployment. 
    • Search Mode: Choose between tstats and raw search modes. 
    • Root Search Constraint: Define the base search criteria, such as specific indexes or sourcetypes. 
    • Break By Logic: Optionally, specify additional fields to segment entities further (e.g., by region or department). 
    • Time Quantifiers: Set the time range for data evaluation (e.g., earliest and latest times). 
    • Cron Schedule: Determine how frequently the tracker runs.​ 
       

    Now we just need to simulate the search and create the tracker! Once you have done this there will be another dialog box where you can run the tracker, click to run the tracker now.  
     
    You should now see data sources in the tenant! This will give you a data source per sourcetype since that’s how we set it up. 
     

    TrackMe dashboard showing 31 enabled mac data sources and their indexing metrics.


    Dedicated Tracker  
     
    The dedicated tracker is used to look at a specific data source and having a dedicated tracker allows for more customization. Like specifying a particular search time field or field extraction you want to look for. I set up my next example with EVENTID=EXAMPLE to show this.  
     
    First to set it up we click the “Manage: elastic sources” button, then “Create new elastic source”. For my tracker parameters I am using these: 
     
    Entity Identifier – “Dedicated EVENTID=EXAMPLE”  

    Type of Search – “raw(local)” (using a raw search makes sure we can collect on search time fields and field extractions) 

    Elastic source creation interface with identifier input and raw search type selection.

    Search Constraint – “index=dedicated EVENTID=EXAMPLE” 
     
    Value for Index – “dedicated” (These inputs for value of index and sourcetype are just labels for the entity when you open them in TrackMe)  

    TrackMe configuration screen for defining elastic search constraints with index and EVENTID.

     
    Earliest – “-4h” (this allows the tracker to look back at the past 4 hours for the events were searching for) 
     
    Now we can simulate the search and see if we get something back and then click “Add as new dedicated tracker” 
     

    Input section for pseudo index and sourcetype values in an elastic source definition.


    Now we will find the “Dedicated EVENTID=EXAMPLE” entity in the TrackMe tenant! 
     

    TrackMe test results for elastic source simulation showing successful data detection.


    Shared Tracker 
     
    Shared trackers are just like dedicated trackers except they put all the entities under one tracker. This way you can add your entities that require raw searches into one place but be careful not to put too many into a shared tracker if you have a small environment as this search could take more resources to complete. The helpful part of this is the ability to re-run one tracker and update many entities that have search time fields/field extractions. 
     
    The same steps used in creating a dedicated tracker can be used to create a shared one, except at the end you would instead click the “Add to the shared tracker” button.  
     
    I created two entities under the shared tracker. Shared and Hello entities. These two entities look at different indexes, yet they fall under the same tracker.  

    Dashboard displaying dedicated, hello_msg, mac and shared trackers with active monitoring.

    Running Tracker Reports 
     
    When running the different trackers, we can be selective with this if they need to be re-run. This is where separating your trackers can be useful. For instance, we have some entities that come in once a day and if for some reason Splunk doesn’t run the tracker correctly the one time in the day that we set it to run and we see the data is there, we can run the tracker again to correct any false alerts.  
     
    To re-run a tracker, we click the “Run: Trackers reports” button. From here we can select hybrid, dedicated, or shared.

    Trackers modal in TrackMe showing manual run options for hybrid, elastic, and sampling trackers.

    Re-running the shared tracker will start the search immediately, the other two will give dialog boxes to select the specific tracker you would like to run.  
     
    Utilizing these different types of trackers correctly can help reduce processing and increase accuracy of your trackers so you can make sure your data is coming into Splunk as it should.

    Need help optimizing your TrackMe setup or managing Splunk at scale? Talk to our experts!

    About the Author

    Tyler Phillips is a Splunk Consultant with a Splunk Core Certified Consultant certification. Tyler is also Splunk IT Service Intelligence Certified Admin accredited along with his Splunk Cloud accreditations. Tyler current learning goal is to receive the Splunk O11y Cloud Certified Metrics User Certification. Tyler has worked on projects customizing Splunk dashboards, Splunk ITSI, TrackMe, and upgrading Splunk environments to 9.x. He has gained experience with a multitude of Splunk items through the Splunk ODS service.  In this service, Tyler has learned the ins and outs of troubleshooting and has gained valuable experience in Splunk problem solving. Tyler resides in Georgia and has received his Information Technology degree from Georgia Southern University. 

  • A Quick Way to Find Substrings in Strings

    A Quick Way to Find Substrings in Strings

    By Jon Walthour, Senior Technical Architect

    Back when I was an Oracle database administrator, one function I often used was INSTR(). In Oracle SQL, the INSTR function could look for a substring inside a larger string and return the position of that substring inside the string. It also allowed me to search for the second, third and fourth occurrence of that substring. There are several techniques you can use in SPL to find a substring in a larger string. These include match() and like(). I find sometimes these functions are insufficient where, say, I want to find if a string contains multiple occurrences of a substring. A quick solution I often use is to leverage Splunk’s multivalue functions.

    First, is “split”. split takes a string and creates a multivalue field from it. Second, is “mvcount”. mvcount takes a multivalue field and counts the number of items in it. Taken together, if you split a string by the substring you are looking for, the count of items in the resulting multivalue field would be 2 if it was found; 1 if it wasn’t. Additionally, if the string you’re looking for is found twice, the result of mvcount would be 3.

    A screenshot of a Splunk "New Search" page showing an SPL query that uses eval, split, and mvcount commands to find and count substrings within a defined string, with the result displayed in the statistics tab.

    This is where using split() and mvcount() together can work better than match() or like(). What if I wanted to find the portion of the string after the second match, with this technique, that’s easy:

    A screenshot of a Splunk search page demonstrating an SPL query using split and mvindex commands to extract a specific substring, showing "reekletters" as the result in the statistics tab.

    To get a count of how many times a substring occurs in a string, you’d just use split() and mvcount() – 1, like this:

    A screenshot of a Splunk "New Search" page showing an SPL query utilizing split and mvcount to calculate the number of substrings within a string, with a result of 2.

    Note that this methodology of using split() and mvcount() works as fast or faster than match() and definitely faster than like().

    So, all together, this method would look like this:

    A screenshot of a Splunk "New Search" page showing an SPL query that uses split, mvcount, and a conditional statement to check for substrings, resulting in "found."

    Finally, to show you how all the INSTR() features, can be realized by this technique, returning the position of the matched string, you could do the following:

    A screenshot of a Splunk "New Search" page showing a complex SPL query that uses split, mvindex, and len functions to find the position of a substring, resulting in "found" at position 20.

    I have endeavored to demonstrate here for you how you can quickly and easily find substrings in strings in the context of “eval” and other evaluation functions that has more flexibility and performs just as fast or faster than the traditionally used functions in this use case, match() and like().

    For more in-depth resources, check out our Resource Center.

    About the Author

    Jon Walthour is an experienced IT professional with over 25 years of experience in administering servers, databases and applications, including over five years of experience helping customers discover success with Splunk as a Splunk Certified Consultant and Enterprise Security Administrator. Jon holds a Bachelors in Psychology from Wright State University in Dayton, Ohio, and a Masters in Divinity from Louisville Presbyterian Theological Seminary. Jon currently resides in Lafayette, Indiana. 

  • Stop Wasting Time: Filter Saved Splunk Reports on Time in Dashboards 

    Stop Wasting Time: Filter Saved Splunk Reports on Time in Dashboards 

    By Eric Levy, Splunk Consultant II

    In a fast-paced world, people don’t have time to wait for reports to generate important metrics. Thankfully, Splunk provides several tools that speed up getting critical results generated for post-processed searches and dashboard panels. The | savedsearch and | loadjob commands allow users to retrieve Splunk results from existing reports or search jobs. 

    • | savedsearch returns the results from a saved search or report. Simply add the title of your search after the command. By default, this will use the time range defined in the saved search or report. However, selecting your own time range in the Time Picker overrides this setting. 
    • | loadjob loads results from an already run search job using the search job id (sid) and uses the time range of the existing search job. 

    Using these in dashboards can raise a problem: using | savedsearch in a base search or any use of a | loadjob loses the ability to control the time range with the Time Picker due to a pre-selected time range value. You can tokenize the time value within the base search if you’re using a | savedsearch, but let’s say we are unable for the sake of this example. 

    Let’s look at this sample dashboard. There is a | savedsearch used as a base search collecting some simple metrics on my laptop, and the sole panel is a timechart looking at eventtype frequency. The base search is set to look back 7 days. 

    Base Search: 

    | savedsearch MACOS_test_report 

    Panel Search (uses Base Search): 

    | timechart count by eventtype 

    If we try and change the Time Picker to the last 24 hours… nothing happens. 

    Let’s add on some SPL to force the search to use values from the Time Picker. Please note that this method can only be used to filter down from the original time range, rather than expand the search to use a larger time range. 

    Going line by line: 

    | eval earliest="$time.earliest$"

    First, to remove any confusion from tokens or quotes, we store the time.earliest token value (which comes from the Time Picker as the lower time bound) in a variable called “earliest”.  

    | eval latest = if(isnull("$time.latest$") OR match("$time.latest$","now"), now(), "$time.latest$") 

    Next, we set the time.latest token value (which comes from the Time Picker as the upper time bound) with an if() function.  

    When searching All Time, the Time Picker will set the time.earliest token value to “0” and the time.latest token value to nothing. Or, there will be situations where the time.latest variable is set to the literal string “now”. To circumvent this, we set the “latest” variable to the now() function which returns the current time (in epoch format). Otherwise, it returns the time.latest token value as it stands. 

    | eval earliest = if(match(earliest,"[@]|-(w|d{1,2}w)"), relative_time(now(), earliest), earliest)  
    | eval latest = if(match(latest,"[@]|-(w|d{1,2}w)"), relative_time(now(), latest), latest) 

    Don’t worry – the SPL won’t get any more complicated than this. Here, we use an if() function to account for time.earliest and time.latest tokens using time specifier values, which determines relative time from now without needing to use specific timestamps. For example, breaking down “-1d@d” would mean: 

    = looking back in time 

    1d = one day 

    @d = snapped to the start of the day (midnight) 

    More comprehensive documentation on time specifiers can be found here. 

    Returning to the SPL, we compare the earliest and latest values using the match() function using a regular expression that will look for the time modifier format. If there’s a match, we use the relative_time() function, which takes an epoch time value (or the now() function, as used above) and offsets the time by the selected time modifier, which in this case would be our earliest and latest variables. This is returned in epoch time format. Otherwise, it returns the earliest and latest values as they stand. 

    | where _time >= earliest AND _time <= latest 

    After normalizing the earliest and latest values to epoch time, we filter results where _time is between the earliest and latest values (inclusive). If done correctly, this will return the desired time range! 

    When we add the SPL to the dashboard, we only see data from the selected time range. However, since the time range of the search is still technically 7 days, we still see 7 days’ worth of rows. 

    To remove the empty rows, use this SPL (or a variation of it, depending on the panel’s format) to only filter on columns whose total values do not equal zero: 

    | addtotals col=f 
    
    | where Total > 0 
    
    | fields - Total 

    Now we can see the table properly filtered for the Time Range selected. 

    Here is the complete search: 

    | savedsearch MACOS_test_report  
    | eval earliest="$time.earliest$"  
    | eval latest = if(isnull("$time.latest$") OR match("$time.latest$","now"), now(), "$time.latest$") 
    | eval earliest = if(match(earliest,"[@]|-(w|d{1,2}w)"), relative_time(now(), earliest), earliest)  
    
    | eval latest = if(match(latest,"[@]|-(w|d{1,2}w)"), relative_time(now(), latest), latest) 
    | where _time >= earliest AND _time <= latest 
    
    | timechart count by eventtype 
    
    | addtotals col=f 
    
    | where Total > 0 
    
    | fields - Total 

    Happy Splunking! 

    Need help scaling your saved searches, reports, or dashboards? Engage TekStream’s Splunk architects.

    About the Author

    Eric Levy is a Splunk Core Certified Consultant who joined the TekStream team in July 2022. Eric’s background and eagerness to learn makes him excited to unlock the data possibilities Splunk has to offer its clients. Eric’s portfolio of projects makes him well adapted to time management and a diverse array of technical situations and has since expanded his horizons into Enterprise Security engagements as well as a full-time member of the IRS Splunk team. Eric resides in Arlington, Virginia and is a proud Virginia Tech graduate. In his free time, he continues to pursue his love of music.

  • When Outsourcing a SOC Makes Sense vs. Augmenting SOC Team

    When Outsourcing a SOC Makes Sense vs. Augmenting SOC Team

    By Hermes Ramos, Splunk Consultant II

    The decision to establish or even augment an internal Security Operations Center (SOC) versus outsourcing SOC services involves various factors, including costs, expertise, control, and specific organizational needs as well as strategic objectives. Here are some considerations for when outsourcing a SOC makes sense versus establishing or augmenting an existing SOC team:

    Cost

    Limited Budget: With budgetary constraints, economic challenges, staff salaries, training, and benefits organizations will find it challenging to invest in the infrastructure, tools, and personnel required for an in-house SOC.

    Establishing a more comprehensive and mature security posture often involves higher initial and ongoing investments as the choice of security tools and technologies, such as SIEM, intrusion detection systems, and endpoint protection, can impact costs. Advanced solutions often come with higher price tags for augmenting an existing SOC team.

    Outsourcing is a more cost-effective solution with faster adoption with relatively quick deployment of security services without the lead time associated with hiring and training an internal team.

    Expertise and Skill

    The lack of internal expertise required to manage and operate a SOC effectively, or the existing SOC team increasing gaps due to the cost of security tools and technologies as well as the time constraints of mastering such tools can leave your organization vulnerable to security threats.

    Outsourcing provides access to a specialized team of security professionals with the time to maintain the rigorous ongoing training to keep up with the industry and security challenges without compromising the security posture of your organization.

    24/7 Coverage

    In today’s fast-paced and interconnected digital landscape, the importance of robust security operations cannot be overstated. As organizations increasingly rely on technology to drive their operations, the need for comprehensive security measures including: Proactive Threat Detection, Incident Response and Mitigation, Endpoint Security, IDPS, Compliance with Regulations, and others are extremely vital for the security of any organization 24/7/365.

    To ensure the continuous monitoring needs and enforcement of the needed security measures outsourcing often provides 24/7/365 monitoring and response capabilities in comparison to the challenges in maintaining an internal team working around the clock.

    Scalability

    For most organizations the fluctuating security needs can be very challenging on the business goals and engineer workforce, where outsourcing allows for scalable services. By outsourcing your SOC, you can adjust resources based on growth-demand, ensure compliance with industry regulations and standards effortlessly, and provide flexibility that may be challenging for an in-house team.

    An in-house SOC team might be able to provide some control and customization, knowledge of internal systems, and integration with business operations. In reality, after working on a few In-house SOC teams and outsourcing SOC, I have found even these benefits can be challenging as the control is often limited to be effective and the internal systems knowledge is often siloed between system owners and organizational departments.

    By outsourcing the cybersecurity functions, organizations can benefit from a cost-effective solution that eliminates the need for substantial upfront investment, scalable services allowing you to adapt to the dynamic nature of cybersecurity challenges, the expertise of security professionals, access advanced security technologies, and ensure a proactive and responsive approach to emerging threats, ensuring that your organization remains secure and compliant with industry regulations.

    Read more about Security and SOC topics here.

    About the Author

    Hermes Ramos is a highly motivated and detail-oriented technology professional with over twelve years of experience in Security Vulnerability Management and SIEM. His expertise spans Splunk Enterprise On-Prem Architecture, Splunk ITSI, Splunk ES, and Cloud Security Architecture, along with a solid foundation in Security Compliance, Networking Security, and PCI-DSS Risk Mitigation. Throughout his career, Hermes has successfully navigated diverse industry landscapes, including Banking, Healthcare, Government, and various Private Corporations. Notably, he optimized the Splunk architecture at GE Corp., reducing costs associated with AWS cloud services while supporting their Enterprise Security Deployment and ITSI implementation. 

    Currently, Hermes is focused on ensuring the successful architecture and deployment of Splunk ES for TekStream customers, emphasizing Security Compliance and vulnerability management. His work includes enhancing the cybersecurity posture of Austin Independent School District in Austin Texas and San Jacinto College in Houston, Texas. Dedicated to continuous improvement and innovation, Hermes stays current with the latest Cybersecurity/SIEM developments and integrates cutting-edge advancements. Recognized for his exceptional expertise, he was invited to speak at the Splunk Conference in Las Vegas in June 2024 about SPL2 and the Splunk Edge Processor. 

  • Threat Intelligence Framework functions in Splunk ES

    Threat Intelligence Framework functions in Splunk ES

    By Kamal Dorairaj, Senior Splunk Consultant

    Overall Framework

    In the Splunk Enterprise Security App, navigate to Configure -> Data Enrichment -> Threat Intelligence Management. Here, you’ll find a variety of out-of-the-box threat intelligence sources. Enabling any of these sources triggers a process where a Modular Input downloads and integrates them into the KV Store. Subsequently, various searches extract this data for use in threat lookups, which are then utilized in threat intelligence correlation searches and threat intelligence dashboards.

    Enabling Threat Source and Threat Matching

    To activate threat intelligence, go to ES -> Configure -> Data Enrichment -> Threat Intelligence Management. Enable relevant threat sources for your organization. Next, navigate to the “Threat Matching” tab.

    Within Threat Matching, you can view CIM fields from data models that are checked for matches against IOCs from the threat intel lookups. When a match is found, an event is written in the threat_activity index which also populates the Threat_Intelligence data model. The `Threat Activity Detected` Correlation search will then trigger a notable.

    Threat Intel Collections

    All data onboarded from Threat Intel feeds in Step 1 flows into the nine supported threat intel collections in ES. To view these collections, navigate to Settings -> Advanced Search -> Search Macros and search for “all_threat_intel”:

    `email_intel` | `file_intel` | `process_intel` | `registry_intel` | `service_intel` | `user_intel` | `http_intel` | `ip_intel` | `certificate_intel`

    These macros represent the IOC collections. You can inspect the contents of each collection using commands like:

    | inputlookup ip_intel

    or

    | inputlookup file_intel | stats count by threat_key

    For details on the fields supported by each collection, visit Settings -> Lookups -> Lookup Definitions and search for the respective collection (or search for *_intel). Only the supported fields defined for each collection will be utilized in the framework.

    For details on the fields supported by each collection, visit Settings -> Lookups -> Lookup Definitions and search for the respective collection (or search for *_intel). Only the supported fields defined for each collection will be utilized in the framework.

    To enable the out-of-the-box threat intelligence correlation search, navigate to Configure -> Content -> Content Management. Select “Correlation Search” from the “type” dropdown menu and filter for “Threat Activity Detected”.

    Once this search is enabled, any identified IOCs will automatically trigger a notable event. To review the resulting incidents, proceed to Incident Review and filter for “Threat Activity Detected” to display a list of alerts generated by the correlation search. Expand any specific incident alert and click on “Contributing Events” located on the right side to access detailed information.

    Threat Dashboards

    Threat Activity and Threat Artifacts are two essential threat intelligence dashboards in ES. To access these dashboards navigate to Security Intelligence -> Threat Intelligence and chose either `Threat Activity` or `Threat Artifacts`.

    Note that these dashboards utilize the Threat_Intelligence data model, which is populated by the threat_activity index.

    Custom Threat Source

    You can also upload custom threat sources into the framework. Ensure that the fields in your CSV file correspond with those in the nine collections; any mismatches will be ignored.

    When debugging threat intelligence, two log sources found with the following query are particularly useful:

    index=_internal source=”*threat*”

    The logs of interest are threatmatch.log, which monitors the state of threat matching work, and threatlist.log, which tracks the onboarding of threat lists. When reviewing these logs, the status field will display their respective phases.

    There are threat match lookup generating searches that separate out the data in the nine collections into match lookups. We can see those lookups here. 

    Settings -> Lookups -> lookup definitions 

    Clear the filters and search for threatintell_by 

    These lookups are used with the threat match searches that we looked at the Step3. 

    This completes the overview of the data flow of threat framework in Splunk ES.

    Threat Intelligence Framework:

    https://dev.splunk.com/enterprise/docs/devtools/enterprisesecurity/threatintelligenceframework

    MISP Integration:

    https://conf.splunk.com/files/2020/slides/SEC1579C.pdf

    https://www.splunk.com/en_us/blog/security/integrating-covid-or-any-threat-indicators-with-misp-and-enterprise-security.html

    Reference Upload (#2):

    https://lantern.splunk.com/Security/Product_Tips/Enterprise_Security/Using_threat_intelligence_in_Splunk_Enterprise_Security

    Use Cases:

    https://research.splunk.com/detections

    Threat Intel API Reference:

    https://docs.splunk.com/Special:SpecialLatestDoc?t=Documentation/ES/latest/API/ThreatIntelligenceAPIreference

    Adding threat intel:

    https://docs.splunk.com/Documentation/ES/7.0.1/Admin/Addthreatintel

    Add threat intel from events:

    https://docs.splunk.com/Documentation/ES/7.0.1/Admin/Addthreatintelfromevents

    Change Threat intel:

    https://docs.splunk.com/Documentation/ES/7.0.1/Admin/Changethreatintel

    Customize/Create Threat Matching:

    https://docs.splunk.com/Documentation/ES/7.1.0/Admin/Createthreatmatchspecs

    Add-ons and conf links:

    https://www.splunk.com/en_us/blog/security/integrating-covid-or-any-threat-indicators-with-misp-and-enterprise-security.html

    https://www.splunk.com/en_us/blog/security/how-do-i-add-covid-threat-intelligence-from-the-internet-to-enterprise-security.html

    https://splunkbase.splunk.com/app/4335

    https://conf.splunk.com/files/2020/slides/SEC1579C.pdf

    https://www.splunk.com/en_us/blog/security/threat-intel-and-splunk-enterprise-security-part-1-what-s-the-point-of-threat-intel-in-es.html

    Mission Control:

    https://www.youtube.com/watch?v=K9D2_Ar9biA

    https://docs.splunk.com/Documentation/MC/Current/Detect/Intelligence

    Learn more about our Splunk managed services.

    About the Author

    Kamal Dorairaj has over 22 years of diverse IT experience with full cycle development of various Applications and Systems. In his first 10 years; he worked as a CRM Consultant at the client locations includes Middle East, India, US; in various domains includes Retail, Telecom, eCommerce. Later he worked as a Lead SRE at Stubhub (was eBay company) for 7 years as a SME in Splunk, GCP. He is a PMP certified, ITIL certified, CompTia Security+ certified and Splunk Architect, Splunk ES Admin, Splunk Developer certified.  He also completed Cybersecurity for Managers, Business Analytics from MIT Sloan and MBA in Technology Management. His core interest area has been, ‘Get more business value out of big data’. 

    I welcome opportunities for new challenges and creative thinking. I am a lifetime learner, continue to learn new technology and skills quickly, and apply them to solve real problems and drive to innovate. 

  • Splunk Users Beware: How Small Sourcetype Errors Cause Big Data Problems!

    Splunk Users Beware: How Small Sourcetype Errors Cause Big Data Problems!

    By David Allen, Senior Splunk Consultant

    Splunk excels in processing provided information effectively, yet incorrect settings can lead to significant complications. Splunk users must proceed cautiously, considering long-term implications, particularly when configuring sourcetype settings.

    In this blog I will show what happens when what appears to be “very” small REGEX issue can cause one quarter of the events to disappear and flagging many timestamp parsing issues.

    Date Configuration Issues

    This issue manifested itself as a Data Quality / Timestamp Parsing Issue. The Timestamp Parsing issue showed up at the beginning of every month and lasted until the 10th of the month and corresponded with a significant drop in the number of events at the beginning of each month.

    Notice in the graph to follow that there are approximately 200,000 events per hour on Sunday, March 31. Then the count dropped to less than 5000 per hour at the beginning of April 1.

    Splunk event timeline showing drop-off in data ingestion on April 1 due to sourcetype misconfiguration.

    Now you might be thinking “What is the big deal – this could be real data” and that is true. But it is suspicious, and it did also flag many Timestamp Parsing issues. So first, let’s look at the LINE_BREAKER and see if it is setup correctly.

    Here are the events on March 31 where the LINE_BREAKER is working correctly….

    DHCP log events from March 31 with missing or default values, highlighting inconsistent data patterns.

    Here is 1 event on April 1 since the LINE_BREAKER does not work for these events.

    April 1 Splunk log entries showing malformed and duplicated log formatting due to sourcetype errors.

    Here is the original LINE_BREAKER regex. See how it does not work for events on April 4 but works just fine for March 31. Why is this? Look closely at the regex and see if you can figure it out.

    Splunk regular expression test failing to match inconsistent timestamps from malformed log events.

    Did you catch the error? The error is with the whitespace “s” as shown below…

    Highlighted regex pattern with incorrect whitespace matching, causing sourcetype parsing failures.

    This whitespace regex only allows for ONE whitespace character in front of the date which is correct when there are two digits in the date of the month (10-31). However, when there is only 1 digit for the date of the month then this REGEX does not work for the LINE_BREAKER setting.

    By allowing for more than 1 whitespace character in the REGEX below we can see the issue is fixed.

    Updated regular expression successfully matching all intended log entries across multiple dates.

    Now we have a valid LINE_BREAKER REGEX. Let’s look at why the Timestamp parsing issue showed up on the Data Quality screen.

    The Splunk time format documentation shows that there are two settings for the date.

    Reference table comparing %d and %e for parsing day of month in timestamp formats.

    In our example, the setting was mistakenly set to %d instead of %e. One might think such an error would be obvious upon reviewing the data. However, it’s important to consider that the initial date setting might have been chosen during a mid-month period with a limited dataset where everything appeared to function correctly during ingestion. This assumption typically holds true in most cases, around 99% of the time. Waiting until the start of the month to observe date behavior might not always be practical, but analyzing events spanning an entire month should provide sufficient data to select the correct setting.

    Putting it all together…. Here is the original sourcetype definition with the incorrect LINE_BREAKER and TIME_FORMAT….

    Incorrect Splunk props.conf configuration using %d in TIME_FORMAT, leading to timestamp mismatch.

    Here is the corrected sourcetype definition. Notice the %d was changed to %e and the whitespace REGEX in front of the date has been changed to allow for more than 1 character.

    Updated props.conf using %e and fixed whitespace in LINE_BREAKER for accurate event parsing.

    The above changes were implemented on April 3rd, and you can see below the event count returning back to the 200,000 per day count.

    Splunk event timeline showing recovered data visibility starting April 3 after sourcetype correction.

    Remember the April 1 event that many events all clumped together? Here is what the events look like on April 4th.

    Log data showing timestamp formatting with inconsistent spacing in Splunk event logs.

    Hour Configuration

    Similarly, incorrect configuration of the hour setting can impact the LINE_BREAKER if the hour is part of the LINE_BREAKER regex. Even if events are correctly segmented, an incorrect hour setting in the TIME_FORMAT can prevent Splunk from identifying the timestamp within the event, resulting in a timestamp parsing error. Splunk will then resort to alternative methods to calculate the timestamp.

    To setup the hour correctly for the TIME_FORMAT setting, Splunk has the following setting options available…

    Table comparing timestamp format specifiers %H, %I, and %k for 24-hour and 12-hour clocks in Splunk.

    You will notice that the %H and the %k for the hour are like the %d and %e for the date. So ingesting events in the afternoon (hours 12 – 23) and not checking what the AM hours are set at could be a problem.

    The %I is always a 12-hour clock which can optionally take either a leading 0 but never a leading space. This setting always uses the %p to signify am or pm.  Never use a %H or a %k with a %p.

    Conclusion

    This blog has illuminated the significant repercussions of minor configuration errors within Splunk, particularly in relation to sourcetype settings. The example provided vividly illustrates how overlooking nuances in the LINE_BREAKER regex and TIME_FORMAT settings can lead to substantial disruptions in data interpretation and analysis. This was evident from the drastic reduction in event counts at the beginning of each month, directly linked to erroneous configurations. By promptly addressing these issues, such as adjusting the LINE_BREAKER regex to accommodate varying date formats and correcting the TIME_FORMAT setting the integrity of data processing was swiftly restored. This scenario underscores the critical importance of meticulous configuration management in Splunk deployments, emphasizing the need for thorough testing and validation to ensure consistent and reliable data insights.

    Learn about our Splunk managed services.

    About the Author

    David Allen has over 35 years of experience in the information technology industry, including hardware design, software development, and entrepreneurship. He has extensive experience in various programming languages, development tools and Splunk. David exhibited his entrepreneurship skills when he founded his own AV company and ran it successfully for over 15 years using Splunk as its main data analytics software. As a Sr. Splunk Consultant he works to assist others with their Splunk issues and is constantly learning new technology and especially everything Splunk . 
     

    David holds both a Bachelor of Science in Electrical Engineering and a Bachelor of Science in Computer Science Engineering from LeTourneau University in Longview, Texas as well as two United States Patents. David currently resides in Richardson Texas with his family. 

  • The Elephant in the Room: Cybersecurity Can be Expensive

    The Elephant in the Room: Cybersecurity Can be Expensive

    By Rob Jansen, Chief Executive Officer

    8 Steps to Evaluate New Cybersecurity Proposals 

    It is time to address the elephant in the room: cybersecurity can be expensive. Choosing new or expanded coverage will always include decisions on platform, product & scope selection, the price of the program and the company you trust to implement. This article outlines eight key considerations to a confident and informed decision on the next iteration of your cybersecurity program.  

    Alignment with Business Objectives 

    Consider the threat landscape in your industry and the sensitivity of the data your firm will protect. Vulnerability analysis (the current state of your security program), pen testing, remediation priorities and overall resilience round out a comprehensive risk assessment framework. With this clarity, validation will ensure that protection materializes as designed and other assets that maintain or re-establish operations are in place.  

    Technology Stack Compatibility 

    Ensure the new program is compatible with your current technology stack, including network infrastructure, cloud services and ERP. Leverage technologies like SIEM and SOAR to streamline processes and reduce manual workload. Automation and orchestration decisions at inception will save time later, so consider their ability to integrate with your stack. 

    Incident Response Planning 

    In the event of a breach, successful recovery is dependent upon adhering to well-designed plans that invoke validated backups. Ensure the new program includes playbooks with detailed incident response plans for use cases like ransomware, insider threats and the like. Regular tests and simulated breaches can ensure the team is prepared. And a post-incident review protocol ensure learning and improvement will occur. This ongoing planning and refinement is practice for the event you hope never happens. 

    Monitoring and Threat Intelligence 

    How does the new cybersecurity program implement tools and processes for real-time detection of suspicious activities? Chiefly, actionable intelligence is collected to stay ahead of emerging threats and refine defenses proactively. Managing a cybersecurity portfolio to deliver point-in-time resilience requires clear policies, plans, processes and capabilities that protect against the most recent evolution of threats. The managed services provider you choose will be key to your threat intelligence success. 

    Program Metrics and Continuous Improvement 

    Metrics matter. Track KPI’s such as incident response time, mean time to detect (MTTD), and mean time to resolve (MTTR) for performance clues. Use the metrics in feedback loops among the team and use the lessons learned to continuously refine processes, policies and technologies. Equipping the team with success metrics and enabling them to improve and enhance in real time builds stability and loyalty. 

    Ask potential MSPs about their shift left focus, as this will indicate the value they place on speed, preparation and early detection. By shifting efforts earlier in development to find “pre-attack behaviors” using the MITRE ATT&CK matrix, your cybersecurity will be proactive and not reactive. Advanced providers view this as a vital investment up front. Your DevOps team will be glad to integrate this posture into their new and developing applications.  

    Future-Proofing 

    Stay informed about advancements in cybersecurity, such as zero-trust architectures, AI-driven threat detection and quantum-resistant encryption. Emerging technology can help your security team adapt to new trends and challenges, such as remote work or edge computing. Your cybersecurity program must have a view of the future to be successful in the present, and the ability to modernize in step with technological advancements insures for changes in the future. 

    Vendor and Partner Relationships 

    An advanced-skill managed service provider will implement any cybersecurity program on time and within budget. That skill is earned over time, and often not about any relationship with the sales team. A record of successful deployments and proven technical expertise will be demonstrated in their approach to data ingestion, configuration time, ready-to-use correlation searches and automated playbooks.

    A true partner will show willingness to collaborate with your team using clear communication protocols established at onset. Training, shared workloads and resource allocation will be flexible and will meet your needs, not theirs. The best MSP’s share the workload with your experienced team, and train to match. Look for the best implementation partner in the industry, and make sure their credentials are validated with the software firm in consideration.  

    Cost Management 

    And that brings us back to the elephant in the room. Your firm will incur license and ingest expenses. The combination of platform and partner will influence total cost of ownership significantly. Best in class cybersecurity can be affordable when the MSP effectively and efficiently configures your data and your protocols. Cheap programs beget cheap security; knowing where gaps exist and weighing low data security against the risks your firm is willing to take can aid in your provider selection.  

    Breaches will happen. The ability to quickly detect, respond and remediate them is the difference between successful cybersecurity and a costly, public incident. Repairing your systems and your reputation will be more expensive if your cybersecurity program isn’t properly implemented. The investment you make in your cybersecurity platform will determine how expensive any breach will be. 

    Cybersecurity is an expense on your income statement, but it doesn’t have to be burdensome. Your firm can afford best-in-class security when coupled with detection/response/remediation work from the most experienced MSP you can find. The categories presented here will help you determine if their combined experience and capabilities are a true fit for your firm. 

    Read more about TekStream Security Services.

    About the Author

    As Chief Executive Officer and President, Rob leads daily business operations and oversees the development and execution of the Company’s growth strategy and initiatives. Rob has been in the information technology sector for nearly 15 years providing leadership, consulting and implementation services to leading Fortune 1000 clients. Working with his team of industry-leading executives, Rob oversees all TekStream practice areas and functional disciplines including sales, solution development, and client delivery.  

    Prior to founding TekStream, Rob was Vice President of Sales for Enterpulse/Idhasoft and responsible for forging and managing the strategic alliances of the company, including Oracle, and for selling the solutions which Enterpulse/Idhasoft implemented for its clients. In addition, Rob was responsible for managing and maintaining the company’s sales forecast and serving on an executive team to manage the company’s strategic decisions for sales growth, resource investments, and operational strategy including the profit and loss report. In this capacity, Rob’s leadership allowed Idhasoft to grow revenues at over 220% from 2009-2010 and increased profitability to allow for the continued investment in people, systems and processes to support the organization’s growth. Prior to joining Enterpulse/Idhasoft, Rob spent over 7 years with Plumtree Software and BEA Systems, Inc. (acquired by Oracle, Inc.) in a variety of roles including Southeast Area Sales Manager, Sales Engineering Lead and Implementation Manager, where he provided license sales, process and technical consulting services for the design, development, and implementation of business solutions. During this time, Rob had the opportunity to work with startup, regional and global companies including the American Cancer Society, ExxonMobil and Proctor and Gamble.  

    In addition, Rob was part of the Management Consulting practice of PriceWaterhouseCoopers, where he helped global organizations design and develop Enterprise Resource Planning (ERP) solutions using SAP. Rob received a Bachelor of Science in Systems Engineering with a minor in Management Information Systems (MIS) from the University of Virginia. Rob currently resides in Atlanta with his family. 

  • Running Searches Using Splunk’s REST API: Part Two 

    Running Searches Using Splunk’s REST API: Part Two 

    By Jon Walthour, Senior Technical Architect

    In Part One of this blog, I discussed Splunk’s REST API interface and how it can be used to run searches against Splunk event data. In Part One, I demonstrated how to interact with the Splunk REST API to run searches using the Linux cURL app. In Part Two, I’ll take a dive into how to run searches via the REST API utilizing Python.

    For interacting with Splunk through Python, Splunk provides a SDK to abstract some of the more basic methods for Splunk interaction. Mind you, the SDK is not necessary to successfully interact with Splunk via REST and Python, but it does make that interaction much easier. 

    Setting Up Your Development Environment

    So, let’s first set up our development environment. Using your git tool of choice, clone the Splunk Python SDK from here: https://github.com/splunk/splunk-sdk-python.git. As of the current 2.0.1 release, you’ll also need to install into your Python libraries if you don’t already have it the Python deprecation modules. Once you’ve done those two things, you can cp the “splunklib” directory and contents out of the “splunk-sdk-python” folder as that is all you need from it. What I do on a Linux host is to run the following in an empty directory: 

    git clone https://github.com/splunk/splunk-sdk-python.git 
    cp -R splunk-sdk-python/splunklib . 
    pip install deprecation 

    and I’m ready to go.

    Now, in our new development context, open new Python (.py) file. We’ll need to start by importing two modules in the Splunk Python SDK “splunklib”, client and results.

    import sys 
    import splunklib.client as client 
    import splunklib.results as results 
    from time import sleep 

    The “client” module provides objects and collections for authenticating to and interacting with a Splunk instance over its management port (default port 8089). The “results” module provides a reader for streaming results in CSV, JSON or XML to a client’s environment from the Splunk search head. For running adhoc searches, these are the only two modules we’ll need. 

    Once we’ve got all the Python, we’ll need imported, we start by authenticating to our Splunk search head by creating a “service” object using the “client” module. As we did when using curl in Part 1 of this blog, we can authenticate with either a username and password or with an Oauth token. The username/password formulation of the “service” object creation looks like this: 

    service = client.connect(host='{Splunk search head}', port={management port}, username='{username}', password='{password}') 

    For OAuth token authenticataion, we utilize the parameter “splunkToken” like this: 

    service = client.connect(host='{Splunk search head}', port={management port},  splunkToken='{OAuth token}') 

    Going forward, this service object will be our portal into the Splunk search head. Next, we want to instantiate an instance of the “job” class in the “client” module, create A variable to hold the contents of our search string and a couple of dictionaries to pass in parameters for our search and for retrieving the output of the search like so: 

    jobs = service.jobs 
    search = 'search index=_internal sourcetype=splunkd | head 5' 
    kwargs_search = {'exec_mode': 'normal'} 
    kwargs_results = {'output_mode': 'json', 
      'count': 0 
      } 

    Executing A Search In Splunk

    As we discussed in Part 1, there 4 modes for executing a search in Splunk–normal, blocking, oneshot and export. A “normal” search is one that gets submitted to Splunk for execution by the Scheduler, the search is run asynchronously by Splunk and the results are stored on the search head for our later retrieval labelled by a “search ID” or “SID”. So, when coding for a “normal” search, we submit the job and are returned a SID by Splunk. This SID is stored in our instance of the job class. As with our curl example in Part 1, our code polls Splunk regularly waiting for the job to be in a “DONE” state so we can retrieve the results. While the search job is being completed, our code sits in a “while” loop. When the job is done, our code continues to retrieve the results. That would all look like this: 

    job = jobs.create(search, **kwargs_search) 
    
    print("nWaiting for the search to finish...") 
    
    while True: 
      while not job.is_ready(): 
        pass 
      if job["isDone"] == "1": 
        print("nDone!n") 
        break 
      sleep(2) 

    Once the search has completed, we can retrieve the results, in either XML, JSON or CSV formats. For JSON output, which is my personal preference for its ease of use, we instantiate a special class in the results module called “JSONNResultsReader” like this: 

    result_stream = job.results(**kwargs_results) 
    for result in results.JSONResultsReader(result_stream): 
        print(result) 

    To output results in XML or CSV, we utilize the read function in the results module: 

    kwargs_results = {'output_mode': 'xml', 
      'count': 0 
      } 
    
    result_stream = job.results(**kwargs_results) 
    print(result_stream.read()) 

    or 

    kwargs_results = {'output_mode': 'csv', 
      'count': 0 
      } 
    
    result_stream = job.results(**kwargs_results) 
    print(result_stream.read()) 

    That’s the basic flow of running a Splunk search in Python and returning results. There are a couple of helpful caveats to consider, though. We’ve only talked about the “normal” execution mode so far, but for most circumstances, the “blocking” mode or “oneshot” mode can prove a better choice as the “job.create” call won’t return until the job has completed. The “oneshot” approach can be more efficient here, since it only makes one roundtrip to the server to run the search and return the results. By contrast, once a “blocking” search you still have to retrieve the results. However, with a “blocking” search, the results are stored on the search head and can be retrieved again and again for the life of the search. If a oneshot search fails, you have to resubmit it. It also doesn’t handle large resultsets well due to its only making one trip. Therefore, use a “blocking” search for searches that could return a larger resultset and use oneshot only when you’re going to be returning a few results. A oneshot search would look like this: 

    search = 'search index=_internal sourcetype=splunkd | head 5' 
    kwargs_results = {'output_mode': 'json', 
      'count': 0 
      } 
    
    results = results.JSONResultsReader(service.jobs.oneshot(search, **kwargs_results)) 
    for result in results: 
        print(result) 

    For searches you expect to return more than a few results, I’d recommend using a blocking search, where the job created doesn’t return until the job has been scheduled and run. That would look like this: 

    import sys 
    import splunklib.client as client 
    import splunklib.results as results 
    from time import sleep 
    service = client.connect(host='{Splunk search head}', port={management port}, username='{username}', 
    password='{password}') 
    # or use an Oauth token like this: 
    # service = client.connect(host='{Splunk search head}', port={management port},  splunkToken='{OAuth 
    token}') 
    jobs = service.jobs 
    search = 'search index=_internal sourcetype=splunkd | head 5' 
    kwargs_search = {'exec_mode': 'blocking'} 
    kwargs_results = {'output_mode': 'json', 
      'count': 0 
      } 
    job = jobs.create(search, **kwargs_search) 
    result_stream = job.results(**kwargs_results) 
    for result in results.JSONResultsReader(result_stream): 
        print(result) 

    Using Pagination for Large Result Sets

    One final technique to review: pagination. Sometimes you want to run a search and retrieve the results in batches. This is especially useful for very large result sets where you want to avoid filling up buffers. To do this in the results retrieval portion or a normal or blocking search, you would add an offset to the results parameters dictionary like this: 

    numResults = int(job["resultCount"]) 
    offset = 0 
    count = 10 
    while offset < numResults: 
      kwargs_results = {'output_mode': 'json', 
       'count': count, 
       'offset': offset 
       } 
    
      result_stream = job.results(**kwargs_results) 
       for result in results.JSONResultsReader(result_stream): 
       print(result) 
    
    # Increase offset by count 
    offset += count 

    Here you have it: How to interact with Splunk’s REST API to run searches through the Linux command line and cURL and via Python and the Splunk SDK for Python. These are by no means the only ways to intersect with Splunk in code. There are also the Splunk SDKs for Java, JavaScript, Go, Node JS, C#, php, Ruby and iOS and Android Xamarin for Splunk Mint (mobile intelligence). If you have any questions, comments or suggestions, I’d love to hear from you at jwalthour@tekstream. If my words here have helped you to see the expertise the whole TekStream team brings to Splunk, reach out to us at the form provided below. 

    Read more about TekStream Splunk services.

    Missed Part 1? Read Running Searches Using Splunk’s REST API: Part One.

    About the Author

    Jon Walthour is an experienced IT professional with over 25 years of experience in administering servers, databases and applications, including over five years of experience helping customers discover success with Splunk as a Splunk Certified Consultant and Enterprise Security Administrator. 

    Jon holds a Bachelors in Psychology from Wright State University in Dayton, Ohio, and a Masters Divinity from Louisville Presbyterian Theological Seminary. Jon currently resides in Lafayette, Indiana. 

  • Running Searches Using Splunk’s REST API: Part One

    Running Searches Using Splunk’s REST API: Part One

    By Jon Walthour, Senior Technical Architect

    One of the best things I like about Splunk is its flexibility. Splunk is like Legos; you can build just about anything you want with it. What comes with that flexibility is the ability to do just about anything in Splunk outside the web UI and command-line interfaces via Splunk’s REST API. Via the REST API, I can do anything I want in Splunk. If I cannot do it natively, I can always write a custom endpoint in Splunk to make it possible. Today, let me show you a common and straightforward way to use Splunk’s REST API to run a search and retrieve the results. I’ll show you two approaches to doing this–via cURL, Linux’s command-line tool for sending and receiving data with remote systems via URLs, and via Python, using Splunk Python SDK.

    Generally, we will hit the Splunk REST endpoint for running search jobs, “/services/search/v2/jobs”. You could also use “/services/search/jobs,” but this endpoint is deprecated and will eventually no longer work. We’ll pass in some credentials, either a username and password or an OAuth token created in Splunk via “Settings” > “Tokens” (note, this is not a HEC token). Finally, we’ll pass in our search via a POST to the REST endpoint. 

    Four Modes

    There are four modes in which we can execute these searches. The first three are called an “execution mode,” and the fourth is an appendage to our endpoint. They are “normal” mode, “blocking” mode, “one-shot” mode, and “export” mode. A normal search runs asynchronously. It returns a search job immediately. Poll the job to determine its status. You can retrieve the results when the search has finished. You can also preview the results if “preview” is enabled. Normal mode works with real-time searches. A blocking search runs synchronously. It returns a search job once the search has finished, so there is no need to poll for status. Blocking mode doesn’t work with real-time searches. A one-shot search is a blocking search that is scheduled to run immediately. Instead of returning a search job, this mode returns the search results once completed. Because this is a blocking search, the results are available once the search has finished. Normal and blocking searches work with the search job scheduler, create search IDs (SIDs), and save results on the search head that can be retrieved later upon request. Oneshot searches run immediately without the job scheduler and stream the results back immediately, meaning they are not saved on the search head, and if the stream is interrupted for any reason, the results are not recoverable without rerunning the search. 

    Export Mode

    The fourth mode, “export” mode, is a mode of running a one-shot search so its output is formatted for easy use in other contexts. What I mean is that a normal, blocking, or one-shot search returns extra fields along with the results to detail such things as the indexer and index bucket the event came from, the time the event was received by that indexer, and the subseconds of the event’s timestamp. Export search results do not have these extra metadata fields, only the result’s serial number (order in the result set), the time of the event, the event’s host, source and sourcetype, the index, and indexer from which the event came along with the event itself. Not all these fields would be present in a transforming search, like one that uses the “stats” command. 

    So, let’s start with a basic search run via curl–but first, a few notes on the structure of these REST calls. 

    You must authenticate to a Splunk search head to use these REST endpoints. This will either be a username and password or a Splunk Oauth token. While you can technically run a search on an indexer, you will only get results from the index buckets stored on that indexer. So, you authenticate to a search head connected to several indexers to get complete results. Finally, you authenticate to Splunk’s management port, port 8089 by default. This is the port Splunk listens on for these sorts of communications. Don’t try to use the web UI port, which is usually port 8000; it won’t work. 

    curl -s -k -u {username}:{password} https://{Splunk search head}:{management 
    port}/services/search/v2/jobs  
        -d search="search index=_internal sourcetype=splunkd | head 5"  
        -d earliest_time="-7d"  
        -d earliest_time="-7d"  
        -d namespace="search"  
        -X POST 
        

    Now, let’s deconstruct our curl command. All these elements will be present in any approach you use to run a search on Splunk. Note that all these elements are passed as data elements in the HTTP request. To learn more about any of them, consult Splunk’s online documentation. 

    – “search” – the content of the search to be run by Splunk 

    – “earliest_time” – the earliest time a search can look back to retrieve event data. If this is not included, Splunk defaults to the beginning of Epoch time, January 1, 1970, 12:00:00 AM UTC. 

    – “latest_time” – the latest time a search can look to retrieve event data. If this parameter is not included, Splunk defaults to “now,” which is the time the search is run. 

    – “namespace” – the app context in which the search is to be run 

    This curl command would submit the search to Splunk and return a search ID (sid). To get the search results, we’d run a second curl command hitting the same REST endpoint with the SID appended to it. This will return details about the search along with its status, whether done or not, in a field called “dispatchState.” 

    curl -s -k -u {username}:{password} https://{Splunk search head}:{management 
    port}/services/search/v2/jobs/{search id} | grep dispatchState 

    The value of “dispatchState” will be one of the following: QUEUED, PARSING, RUNNING, FINALIZING, DONE, PAUSE, INTERNAL_CANCEL, USER_CANCEL, BAD_INPUT_CANCEL, QUIT, FAILED. We’re looking for “DONE”. Once in that “DONE” state, we run a third curl command to retrieve the results stored on the search head. 

    curl -s -k -u {username}:{password} https://{Splunk search head}:{management 
    port}/services/search/v2/jobs/{search id}/results  
    -d output_mode="json" 

    The “output_mode” parameter tells Splunk how to display the output. It can be either “xml” (the default), “json,” or “csv.” 

    When the results stream back, they are in one long stream of structured json. If the layout of these results matters to you, this is where “export” mode comes in. Again, “export” is not a data parameter. With the “export” endpoint, results are outputted in a layout of one event per line. Especially with “json” and “csv” output modes, utilizing this “export” mode layout can be handy. Additionally, I usually run these “export” searches with the “oneshot” exec mode. This runs the search immediately, outside the Splunk Scheduler. However, this also means no results are stored on the search head. So, if something happens to interrupt the search, it will need to be rerun. 

    curl -s -k -u {username}:{password} https://{Splunk search head}:{management 
    port}/services/search/v2/jobs/export  
        -d search="search index=_internal sourcetype=splunkd | head 5"  
        -d exec_mode="oneshot"  
        -d earliest_time="-7d"   
        -d latest_time="now"  
        -d output_mode="json"   
        -X POST 
         

    Finally, let me cover Splunk’s OAuth tokens in this first part of this blog. There are circumstances where you don’t want to store a password in clear text, which could be used by a bad actor to log into Splunk UI. You could instead use a token. Creating and managing Splunk OAuth tokens are topics beyond the scope of this blog article, but you can use them in place of the username and password when constructing the curl command. The token also goes in the header of the HTTP request. Using a token, called a “Bearer” token, our example search would look like this: 

    curl -s -k https://{Splunk search head}:{management port}/services/search/v2/jobs  
        -H "Authentication: Bearer {OAuth token}"  
        -d search="search index=_internal sourcetype=splunkd | head 5"  
        -d earliest_time="-7d"  
        -d namespace="search"  
        -X POST
        

    Notice that we no longer pass in the username/password with the “-u” option. Rather, we have a new header parameter passing in the Bearer token, that long 442-character string, to Splunk for authentication. With Splunk’s REST API, you can always use OAuth Bearer tokens instead of username/password combinations. 

    That’s it for this month. In the coming months, Part 2 of this blog article will explain how to use Splunk’s Python SDK to do all this and more with the Splunk REST API. 

    Read more about TekStream Splunk services.

    About the Author

    Jon Walthour is an experienced IT professional with over 25 years of experience in administering servers, databases and applications, including over five years of experience helping customers discover success with Splunk as a Splunk Certified Consultant and Enterprise Security Administrator. 

    Jon holds a Bachelors in Psychology from Wright State University in Dayton, Ohio, and a Masters in Divinity from Louisville Presbyterian Theological Seminary. Jon currently resides in Lafayette, Indiana. 

  • Healthcare Cybersecurity Solutions: Why They’re Essential for Modern Healthcare

    Healthcare Cybersecurity Solutions: Why They’re Essential for Modern Healthcare

    The healthcare sector holds large amounts of sensitive digital data, making it an attractive target for hackers. Every healthcare institution should have healthcare cybersecurity solutions to protect patient information and hospital operations from threats.

    Digital attacks on healthcare data have become more common, and hackers are adopting methods such as ransomware, phishing, social engineering, and DDoS attacks. Many healthcare settings use outdated systems with vulnerabilities, making them easy entry points for hackers.

    Healthcare organizations targeted by cyberattacks are left grappling with financial expenses and damaged reputations. Cyber threats also put patients at risk by blocking providers from accessing the systems, which delays treatments.

    One way to protect patient data is to comply with regulations such as HIPAA (Health Insurance Portability and Accountability Act), which require healthcare organizations to implement specific security measures. Adhering to these standards helps safeguard sensitive patient data and enhances defenses against cyber threats.

    Healthcare Cybersecurity Challenges

    Healthcare organizations hold 30% of the world’s data, including patient personal health information, Social Security numbers, and financial details. It’s easy to see why cybercriminals would employ every tactic to exploit this data for identity theft, insurance fraud, and blackmail.

    Here are some common challenges faced by healthcare organizations:

    • High-Value Target: Healthcare data encapsulates plenty of personally identifiable information, making it the most prized commodity on the black market. This data has a high potential for misuse and sells more than credit card information. On the dark web, medical records can be worth up to $1,000, and the criminals understand how willing health institutions would be to pay a ransom to recover them.
    • Increasing Attack Surface: Adopting Electronic Medical Records (EMRs) and the growing use of the Internet of Medical Things (IoMT) have transformed healthcare by improving efficiency and patient care. However, they expand the attack surface for threats by increasing the data collected. They’re also vulnerable areas, especially when remote workers access them.
    • Financial Impact: While an average data breach costs $4.45 million in other industries, a healthcare breach costs an average of $10.93 million. This higher price tag is due to the complexity of healthcare data, making it harder to protect and more expensive to recover from breaches. The intricate nature of health records requires extensive forensic analysis to determine what data was compromised and how to remedy the situation.

    Healthcare is a delicate sector entrusted with protected health information (PHI), which introduces the challenge of being a priority target for cyber attackers. This data sells lucratively in the black market and has a bigger financial impact than other industries.

    Common Cybersecurity Threats in Healthcare

    Medical care institutions must be aware of cybersecurity threats to protect patient information, stay compliant, and prevent financial losses. The consequences of cybersecurity threats underscore the importance of cybersecurity in healthcare.

    Let’s look at some of the most common threats:

    Phishing and Social Engineering Attacks

    The hospital environment sees a lot of information exchanged between personnel. Busy healthcare providers may not confirm the sources of every email, potentially leading to a phishing attack. Cybercriminals use social engineering tricks to convince workers to share information with them, which they then use for fraudulent activities.

    Phishing is one of the most commonly used attack vectors in cybersecurity. Given the fast-paced environment, employees can inadvertently fall victim to these attacks, leading to unauthorized access to patient data. Malicious actors might also call help desks claiming to be from a different department and request password resets, using stolen personal information to answer security questions.

    Ransomware Attacks

    Ransomware attacks have become increasingly common in the healthcare sector, where hackers hold sensitive patient data hostage and demand a ransom. These attacks severely disrupt hospital operations and essential services, delay patient care, and leave patients stranded. They often result in substantial financial losses.

    The complexity of ransomware has also evolved, with attackers increasingly employing double extortion tactics — encrypting data and threatening to leak it publicly if demands are unmet.

    Insider Threats

    Cyber threats in the healthcare sector may be external, but employees can also accidentally or maliciously compromise sensitive data. Insider threats may include a disgruntled employee who steals information to sell for revenge or an employee accessing or sharing patient records without authorization.

    Insider threats account for most data breaches in healthcare, emphasizing the need for employee training and access controls.

    The Role of Compliance in Healthcare Cybersecurity

    Complying with regulations regarding healthcare cybersecurity helps prevent patient information from falling into the wrong hands. Compliance is also mandatory, and non-adherence can result in criminal charges and other legal penalties.

    HIPAA and Data Protection

    HIPAA was enacted in 1996 to reform the insurance industry by allowing individuals to keep their health insurance after changing jobs. HIPAA now also helps safeguard patient privacy in the healthcare sector by providing national standards for the protection of sensitive patient health information. It aims to ensure patient privacy, enhance the security of health information, and streamline healthcare administrative processes.

    How does it do this? HIPAA mandates that healthcare organizations establish security policies and procedures to protect PHI. Its security rule requires that healthcare organizations implement administrative, physical, and technical safeguards to ensure the confidentiality, integrity, and availability of electronic Protected Health Information (ePHI).

    Administrative safeguards require organizations to conduct risk assessments, establish access controls, and provide ongoing security training for staff. Physical safeguards involve securing facilities and devices that store or access ePHI. In contrast, technical safeguards include data encryption during transmission, user authentication, and audit controls to monitor access to sensitive information.

    These measures reduce the risk of unauthorized access to patient data and help minimize breaches.

    Ensuring Compliance with Data Retention Laws

    A health organization must establish data retention policies that define how long it will keep different types of data, ensuring compliance with regulations. This includes securely storing sensitive patient information and implementing processes for deleting it when it’s no longer useful.

    Healthcare cybersecurity solutions simplify compliance with these data retention laws while protecting information from unauthorized access. Features such as encryption ensure unauthorized users can’t read the data, whether in storage or during transmission.

    Access controls limit who can view or manipulate sensitive data, reducing the risk of breaches. Additionally, automated compliance tools streamline the management of retention schedules, ensuring that data is retained only for the required duration and securely disposed of afterward. Integrating these cybersecurity features makes it easy for healthcare organizations to manage their data lifecycle while maintaining compliance with regulations.

    Essential Healthcare Cybersecurity Solutions

    The evolving landscape of cyber threats calls for robust healthcare cybersecurity solutions. These solutions keep unauthorized users out and keep data safe.

    Network Security and Firewalls

    Healthcare network security and firewalls filter incoming and outgoing traffic based on predefined security rules, blocking unauthorized access.

    An intrusion detection system (IDS) monitors network traffic for suspicious activity and generates alerts of potential intrusions, allowing administrators to respond quickly to threats. An intrusion prevention system (IPS) detects and actively blocks malicious traffic in real-time, preventing attacks before they compromise the network. Network segmentation isolates sensitive data and systems, limiting the potential impact of a breach.

    These technologies create a multi-layered security approach that protects patient information and ensures compliance with HIPAA.

    Endpoint Security Solutions

    More connected devices in a healthcare organization increase the risk of an attack, so the endpoints must be secure. Securing endpoints such as medical devices, laptops, and mobile devices is helpful as these devices can be vulnerable to cyber threats, making them prime targets for attackers seeking unauthorized access to sensitive information.

    Implementing multi-factor authentication (MFA) enhances security by requiring users to provide two or more verification factors before gaining access. MFA reduces the risk of unauthorized entry even if credentials are compromised. Additionally, strict access controls ensure that only authorized personnel can access specific data based on their roles.

    Data Encryption and Secure Messaging

    Encryption is one of the best methods of making data inaccessible to hackers — even when they gain access. It acts as a safeguard, rendering data unreadable to anyone who does not possess the appropriate decryption keys, mitigating the risks of data breaches.

    Secure messaging tools facilitate safe communication in environments where healthcare providers frequently share PHI. These tools utilize end-to-end encryption to ensure that messages between healthcare professionals and patients remain confidential and secure.

    Security Awareness Training for Healthcare Staff

    As skilled as your staff may be, human error is a major cybersecurity threat. It’s often caused by employees clicking on malicious links or mishandling patient information. Educating staff about common cyber threats and phishing detection reduces the risk of breaches.

    Every healthcare organization should empower employees to be aware of cyber threats. Regular training sessions with real-world examples and interactive components help reinforce these concepts, making staff more vigilant.

    Advanced Medical Cybersecurity Solutions for the Future

    As cyber criminals upgrade their tactics, healthcare organizations should scale their security measures by upgrading cybersecurity solutions. How better to strengthen defenses than to utilize artificial intelligence, automation, and cloud security solutions?

    Artificial Intelligence and Machine Learning

    AI algorithms analyze large amounts of data from multiple sources, identifying patterns and anomalies that may indicate potential cyber threats. This capability is particularly valuable for detecting sophisticated attacks.

    For example, AI can monitor the behavior of IoMT devices in healthcare settings, quickly identifying signs of compromise. AI-driven solutions can automate initial containment actions when a threat is detected, reducing response times.

    The scalability of AI solutions means they can handle the growing volumes of data generated by interconnected medical devices and EMRs, allowing healthcare providers to maintain cybersecurity without compromising operational efficiency.

    Cloud Security Solutions

    Many healthcare institutions have adopted cloud-based applications to enhance operational efficiency, facilitate real-time data access, and improve patient care. However, this shift also introduces significant cybersecurity challenges, requiring cloud security solutions to safeguard patient data.

    One of the best cloud solutions is data encryption, which keeps prying eyes away from patient information. Encryption keeps patient information private and maintains compliance.

    Strong access controls and authentication mechanisms restrict access to authorized personnel, including role-based access controls that align with the principle of least privilege, minimizing the risk of insider threats.

    How to Choose the Right Cybersecurity Services for Healthcare Providers

    Choosing the right cybersecurity for healthcare providers is the answer to safeguarding sensitive patient data and ensuring compliance. But you don’t just need someone who will check the boxes — you want a partner in protecting your data.

    Here are some things to look for when choosing between healthcare cybersecurity companies:

    • Ensure the provider complies with healthcare-specific regulations like HIPAA, HITECH, and GDPR (if applicable).
    • Look for providers with experience in healthcare cybersecurity and knowledge of common threats in the sector.
    • Request case studies or references.
    • Check if the provider uses advanced encryption for data both in transit and at rest.
    • Ensure strong user authentication methods such as multi-factor authentication (MFA).
    • Choose services with round-the-clock detection and response.
    • Ensure the services can scale with the growth of your organization.
    • Verify compatibility with your current electronic health record (EHR) systems, devices, and software.
    • Opt for providers that offer thorough risk and remediation planning to identify and address vulnerabilities specific to your environment.
    • Look up online reviews and testimonials to see what others have said about their experience.

    Protect Your Data with TekStream

    Addressing cybersecurity in healthcare is critical. Reliable healthcare cybersecurity solutions keep guard and ensure that attacks don’t disrupt operations and put patients’ data at risk.

    TekStream’s Managed Detection and Response (MDR) services monitor and detect threats 24/7. Our healthcare cybersecurity services use advanced technology and expert analysis to scan endpoints, networks, and other digital assets and keep you ahead of malicious actors.

    Curious how else we can safeguard your practice? Contact us to learn more!