<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Configured .sh scripts not being run/reporting data in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Configured-sh-scripts-not-being-run-reporting-data/m-p/709699#M117247</link>
    <description>&lt;P&gt;Hello, as best practise you should create and deploy an app from deployment server with your inputs.conf and script. Also make sure you include a valid timestamp at the beginning of the output in US format.&lt;/P&gt;&lt;P&gt;Follow these instructions :&amp;nbsp;&lt;A href="https://dev.splunk.com/enterprise/docs/developapps/manageknowledge/custominputs/scriptedinputsexample/" target="_blank"&gt;https://dev.splunk.com/enterprise/docs/developapps/manageknowledge/custominputs/scriptedinputsexample/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jan 2025 14:53:37 GMT</pubDate>
    <dc:creator>splunkreal</dc:creator>
    <dc:date>2025-01-24T14:53:37Z</dc:date>
    <item>
      <title>Configured .sh scripts not being run/reporting data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Configured-sh-scripts-not-being-run-reporting-data/m-p/709687#M117245</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I created .sh scripts that do the following:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#!/bin/bash

# Name of the service to monitor
SERVICE_NAME="tomcat9"

# Check if the service is running
SERVICE_STATUS=$(systemctl is-active "$SERVICE_NAME.service")

# Output status for Splunk
if [ "$SERVICE_STATUS" == "active" ]; then
echo "$(date): Service $SERVICE_NAME is running."
else
echo "$(date): Service $SERVICE_NAME is NOT running."
fi&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The above is obviously what Im using for Tomcat but I have others all doing the thing just different service names. These scripts reside in:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/opt/splunkforwarder/bin/scripts&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Additionally I have configured these scripts to be run in /opt/splunkforwarder/etc/system/local/inputs.conf an example of what that looks like is below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[script:///opt/splunkforwarder/bin/scripts/monitor_service_&amp;lt;service_name&amp;gt;.sh]&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;disabled = false
interval = 60
index = services
sourcetype = service_status&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As you can see I also have configured the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index = services
sourcetype = service_status&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;These are also configured in Splunk Enterprise respectively and the index is configured for Search, in linux&amp;nbsp; Splunk is the owner and the group is also Splunk. Additionally all of the scripts are executable and successfully run when I test them, however none of this data seems to be passed from the forwarder as none of the expected data is returned including the recognition of the index and sourcetype in Search.&amp;nbsp; Additionally I have attached a screen capture of splunkd.log showing the scripts as being recognized.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2025-01-24_08-46-50.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/34237iA4D3E449C042A8C5/image-size/large?v=v2&amp;amp;px=999" role="button" title="2025-01-24_08-46-50.png" alt="2025-01-24_08-46-50.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 15:09:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Configured-sh-scripts-not-being-run-reporting-data/m-p/709687#M117245</guid>
      <dc:creator>joewetzel63</dc:creator>
      <dc:date>2025-01-24T15:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Configured .sh scripts not being run/reporting data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Configured-sh-scripts-not-being-run-reporting-data/m-p/709699#M117247</link>
      <description>&lt;P&gt;Hello, as best practise you should create and deploy an app from deployment server with your inputs.conf and script. Also make sure you include a valid timestamp at the beginning of the output in US format.&lt;/P&gt;&lt;P&gt;Follow these instructions :&amp;nbsp;&lt;A href="https://dev.splunk.com/enterprise/docs/developapps/manageknowledge/custominputs/scriptedinputsexample/" target="_blank"&gt;https://dev.splunk.com/enterprise/docs/developapps/manageknowledge/custominputs/scriptedinputsexample/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 14:53:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Configured-sh-scripts-not-being-run-reporting-data/m-p/709699#M117247</guid>
      <dc:creator>splunkreal</dc:creator>
      <dc:date>2025-01-24T14:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Configured .sh scripts not being run/reporting data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Configured-sh-scripts-not-being-run-reporting-data/m-p/709704#M117248</link>
      <description>&lt;P&gt;Yes, packaging your content into an app is a good practice but it shouldn't matter much if it's in apps/&amp;lt;app&amp;gt;/local or system/local for actually running the config (unless the settings get overwritten of course).&lt;/P&gt;&lt;P&gt;And no, timestamp doesn't have to be in US format. That's what time parsing sourcetype settings are for.&lt;/P&gt;&lt;P&gt;But back to the &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/275043"&gt;@joewetzel63&lt;/a&gt; 's issue - did you try running the script "as Splunk"? With&lt;/P&gt;&lt;PRE&gt;splunk cmd /opt/splunkforwarder/bin/scripts/whatever.sh&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jan 2025 15:14:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Configured-sh-scripts-not-being-run-reporting-data/m-p/709704#M117248</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2025-01-24T15:14:55Z</dc:date>
    </item>
  </channel>
</rss>

