<?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: can a custom deployment app remove $SPLUNK_HOME/etc/instance.cfg? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/can-a-custom-deployment-app-remove-SPLUNK-HOME-etc-instance-cfg/m-p/525264#M63886</link>
    <description>&lt;P&gt;Thanks! As described above, I went ahead and created&amp;nbsp;guidcleanup.sh like so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
if [[ ! -e /opt/splunkforwarder/etc/instance.cfg.dup_guid ]]; then
 mv /opt/splunkforwarder/etc/instance.cfg  /opt/splunkforwarder/etc/instance.cfg.dup_guid
 /opt/splunkforwarder/bin/splunk restart
fi&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To test this script on a forwarder, I tried using the following commands:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;cd /opt/splunkforwarder/bin; ./splunk cmd ../etc/apps/guid_cleanup/bin/guidcleanup.sh&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...but it failed. It revealed that our previous Splunk admins have been rolling out Splunk forwarders with splunkd running as root!&lt;/P&gt;&lt;P&gt;To fix this particular forwarder, I stopped splunkd, recursively chowned /opt/splunkforwarder to splunk:splunk, then restarted splunkd. After doing this, the above commands ran successfully.&lt;/P&gt;&lt;P&gt;At this point, I'm having difficulty figuring out how to get &lt;STRONG&gt;Splunk&lt;/STRONG&gt; to automatically execute guidcleanup.sh (even after I remove&amp;nbsp;instance.cfg.dup_guid.)&lt;/P&gt;&lt;P&gt;Here's some info from the forwarder:&lt;/P&gt;&lt;P&gt;-bash-4.2$ ls -l ~/etc/apps/guid_cleanup/bin/*sh&lt;BR /&gt;-rwx------ 1 splunk splunk 276 Oct 18 14:40 /opt/splunkforwarder/etc/apps/guid_cleanup/bin/guidcleanup.sh&lt;BR /&gt;-bash-4.2$ grep guidcleanup.sh ~/var/log/splunk/splunkd.log*&lt;BR /&gt;-bash-4.2$ id&lt;BR /&gt;uid=3003(splunk) gid=44399(splunk) groups=44399(splunk)&lt;/P&gt;&lt;P&gt;Here is the forwarder's ~/etc/apps/guid_cleanup/local/inputs.conf:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[script://./bin/guidcleanup.sh]
disabled = false
index = main
interval = -1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, this didn't improve things, either:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[script://$SPLUNK_HOME/etc/apps/guid_cleanup/bin/guidcleanup.sh]
disabled = false
index = main
interval = -1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get Splunk to execute guidcleanup.sh for me?&lt;/P&gt;&lt;P&gt;Lastly, I'm guessing the vast majority of the 600 forwarders have splunkd running as root. If this is the case, then would I be able to run "chown -R splunk:splunk /opt/splunkforwarder" as a scripted input? If not, then I guess there really is no other option than having the Server Admins address these issues themselves.&lt;/P&gt;&lt;P&gt;Thanks again for your input.&lt;/P&gt;</description>
    <pubDate>Mon, 19 Oct 2020 03:35:54 GMT</pubDate>
    <dc:creator>moredonuts20</dc:creator>
    <dc:date>2020-10-19T03:35:54Z</dc:date>
    <item>
      <title>can a custom deployment app remove $SPLUNK_HOME/etc/instance.cfg?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/can-a-custom-deployment-app-remove-SPLUNK-HOME-etc-instance-cfg/m-p/522817#M63663</link>
      <description>&lt;P&gt;I have ~2 months experience with Splunk so far, so my apologies if this is a dumb question:&lt;/P&gt;&lt;P&gt;Can a custom deployment app remove $SPLUNK_HOME/etc/instance.cfg?&lt;/P&gt;&lt;P&gt;Additional background:&lt;/P&gt;&lt;P&gt;We have &amp;gt;3,000 deployment clients, and ~600 of them do not have unique Client IDs. To fix this, I found that we need to simply remove&amp;nbsp;$SPLUNK_HOME/etc/instance.cfg and then restart splunk. Instead of hunting down the countless Server Admins for each of those hosts, I was hoping we could accomplish this via a Deployment App. To prevent the app from repeatedly performing this on the same host, maybe I'd have to implement logic similar to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if [[ ! -e /opt/splunkforwarder/etc/instance.cfg.dup_guid ]]; then
  mv /opt/splunkforwarder/etc/instance.cfg /opt/splunkforwarder/etc/instance.cfg.dup_guid
  /opt/splunkforwarder/bin/splunk restart
fi&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess it might be tedious when I have to manually add the ~600 affected hosts to my custom app's Server Class, but I still think this will be easier/quicker than hunting down the Server Admins.&lt;/P&gt;&lt;P&gt;Appreciate your thoughts.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2020 19:50:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/can-a-custom-deployment-app-remove-SPLUNK-HOME-etc-instance-cfg/m-p/522817#M63663</guid>
      <dc:creator>moredonuts20</dc:creator>
      <dc:date>2020-10-03T19:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: can a custom deployment app remove $SPLUNK_HOME/etc/instance.cfg?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/can-a-custom-deployment-app-remove-SPLUNK-HOME-etc-instance-cfg/m-p/522823#M63664</link>
      <description>&lt;P&gt;The config files in an app cannot overwrite instance.cfg.&amp;nbsp; You can, however, deploy a scripted input in an app and have that scripted input delete instance.cfg and restart Splunk.&amp;nbsp; Your existing shell script should work fine as a scripted input.&amp;nbsp; Be sure to configure the input to run only when Splunk starts (interval=-1).&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2020 23:30:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/can-a-custom-deployment-app-remove-SPLUNK-HOME-etc-instance-cfg/m-p/522823#M63664</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-10-03T23:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: can a custom deployment app remove $SPLUNK_HOME/etc/instance.cfg?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/can-a-custom-deployment-app-remove-SPLUNK-HOME-etc-instance-cfg/m-p/525264#M63886</link>
      <description>&lt;P&gt;Thanks! As described above, I went ahead and created&amp;nbsp;guidcleanup.sh like so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
if [[ ! -e /opt/splunkforwarder/etc/instance.cfg.dup_guid ]]; then
 mv /opt/splunkforwarder/etc/instance.cfg  /opt/splunkforwarder/etc/instance.cfg.dup_guid
 /opt/splunkforwarder/bin/splunk restart
fi&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To test this script on a forwarder, I tried using the following commands:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;cd /opt/splunkforwarder/bin; ./splunk cmd ../etc/apps/guid_cleanup/bin/guidcleanup.sh&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...but it failed. It revealed that our previous Splunk admins have been rolling out Splunk forwarders with splunkd running as root!&lt;/P&gt;&lt;P&gt;To fix this particular forwarder, I stopped splunkd, recursively chowned /opt/splunkforwarder to splunk:splunk, then restarted splunkd. After doing this, the above commands ran successfully.&lt;/P&gt;&lt;P&gt;At this point, I'm having difficulty figuring out how to get &lt;STRONG&gt;Splunk&lt;/STRONG&gt; to automatically execute guidcleanup.sh (even after I remove&amp;nbsp;instance.cfg.dup_guid.)&lt;/P&gt;&lt;P&gt;Here's some info from the forwarder:&lt;/P&gt;&lt;P&gt;-bash-4.2$ ls -l ~/etc/apps/guid_cleanup/bin/*sh&lt;BR /&gt;-rwx------ 1 splunk splunk 276 Oct 18 14:40 /opt/splunkforwarder/etc/apps/guid_cleanup/bin/guidcleanup.sh&lt;BR /&gt;-bash-4.2$ grep guidcleanup.sh ~/var/log/splunk/splunkd.log*&lt;BR /&gt;-bash-4.2$ id&lt;BR /&gt;uid=3003(splunk) gid=44399(splunk) groups=44399(splunk)&lt;/P&gt;&lt;P&gt;Here is the forwarder's ~/etc/apps/guid_cleanup/local/inputs.conf:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[script://./bin/guidcleanup.sh]
disabled = false
index = main
interval = -1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, this didn't improve things, either:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[script://$SPLUNK_HOME/etc/apps/guid_cleanup/bin/guidcleanup.sh]
disabled = false
index = main
interval = -1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get Splunk to execute guidcleanup.sh for me?&lt;/P&gt;&lt;P&gt;Lastly, I'm guessing the vast majority of the 600 forwarders have splunkd running as root. If this is the case, then would I be able to run "chown -R splunk:splunk /opt/splunkforwarder" as a scripted input? If not, then I guess there really is no other option than having the Server Admins address these issues themselves.&lt;/P&gt;&lt;P&gt;Thanks again for your input.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 03:35:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/can-a-custom-deployment-app-remove-SPLUNK-HOME-etc-instance-cfg/m-p/525264#M63886</guid>
      <dc:creator>moredonuts20</dc:creator>
      <dc:date>2020-10-19T03:35:54Z</dc:date>
    </item>
  </channel>
</rss>

