<?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: Universal Forwarder doesn't forward specific log in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Universal-Forwarder-doesn-t-forward-specific-log/m-p/508034#M86453</link>
    <description>&lt;P&gt;Now I've drilled down the problem:&lt;/P&gt;&lt;P&gt;- in my scripted input, the bash script has to , after all changes, restart splunk&lt;/P&gt;&lt;P&gt;- the restart doesn't work because it also kills the process the script needs to function. so it stops splunk, therefore kills the processes and that's it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question: how can I restart splunk after my script did all the changes?&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jul 2020 10:44:15 GMT</pubDate>
    <dc:creator>misterduke</dc:creator>
    <dc:date>2020-07-08T10:44:15Z</dc:date>
    <item>
      <title>Universal Forwarder doesn't forward specific log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Universal-Forwarder-doesn-t-forward-specific-log/m-p/507797#M86419</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;It's my first time writing here so forgive me if my question may lack information.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I want to do:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I want to execute a batch file via scripted input and write the output of this script into a specific log. then I want to send this log to be indexed in another server. all of this should later on be deployed within an app to a universal forwarder which executes the script, writes the log and sends it to a specific server into a specific index.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I've done so far:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I've created an app which as a script in /bin that is basically changing the passwd of the universal forwarder and creating a log in which it echos certain statements. the script itself looks like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!bin/sh

FILE=/opt/splunkforwarder/etc/passwd


if test -f "$FILE"; then
     echo $(date) " $FILE existiert." &amp;gt;&amp;gt; /opt/splunkforwarder/etc/apps/myapp/logging/changepw.log

    #mv /opt/splunkforwarder/etc/apps/myapp/local/inputs.conf /opt/splunkforwarder/etc/apps/myapp/local/inputs.conf.bak
    mv /opt/splunkforwarder/etc/passwd /opt/splunkforwarder/etc/passwd.bak

    echo $(date) " $FILE wurde umbenannt und wird neu erstellt.Inputs.conf wurde deaktiviert" &amp;gt;&amp;gt; /opt/splunkforwarder/etc/apps/myapp/logging/changepw.log


    /opt/splunkforwarder/bin/splunk restart
else
    echo $(date) " $FILE existiert nicht." &amp;gt;&amp;gt; /opt/splunkforwarder/etc/apps/myapp/logging/changepw.log
fi&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;so as of now it should do the following:&lt;/STRONG&gt;&lt;BR /&gt;- check if there is a passwd&lt;/P&gt;&lt;P&gt;- if yes, rename it to passwd.bak , renaming my inputs.conf to inputs.conf.bak (so it uses the inputs.conf in default which has a deactivated scripted input) and then restart splunk. after each previous step it writes a message into changepw.log&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;the inputs.conf looks like this:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[script://./bin/change.sh]
disabled = 0
interval= -1

[monitor:///opt/splunkforwarder/etc/apps/myapp/logging/*]
disabled = 0
index = main&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;my outputs.conf looks like this:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[tcpout]
defaultGroup = splunk_indexer

[tcpout-server://&amp;lt;ip&amp;gt;]

[tcpout:splunk_indexer]
disabled = false
server = &amp;lt;ip&amp;gt;:9997&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;what the problem is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;when I start the script it does at it was told. changing the passwd and renaming it to passwd.bak and writing all echos into a changepw.log then restarting splunk. for whatever reason it doesn't seem to send anything to my server.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I've already checked whether my forwarder is active. it is&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;I can ping the server from the UF&lt;/LI&gt;&lt;LI&gt;I've created a test.log in the same folder in which my changepw.log resides and filled it with some text. after a few moments it appeared on my server, indexed.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;splunk is starting with user splunk and has all the necessary rights to execute, read and write anything within /splunkforwarder&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;did I leave somthing out? I feel like I'm standing right in front of a wall. hope someone can help!&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;edit&lt;/STRONG&gt;: I've noticed that, when I deactivate the script in my inputs.conf and comment out the mv inputs.conf inputs.conf.bak part and start the change.sh, then it works just fine and my server shows the log. why can that be? I assume that, when I mv the inputs.conf the script ends even tho it already started. can that be? if so, the final question would be how does the script need to look like in order to do the following:&lt;/P&gt;&lt;P&gt;- check if there is a passwd, if so change it to passwd.bak , write everything in a log and restart splunk. after restarting splunk should &lt;STRONG&gt;not start the script again.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 10:08:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Universal-Forwarder-doesn-t-forward-specific-log/m-p/507797#M86419</guid>
      <dc:creator>misterduke</dc:creator>
      <dc:date>2020-07-07T10:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Universal Forwarder doesn't forward specific log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Universal-Forwarder-doesn-t-forward-specific-log/m-p/507808#M86420</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223398"&gt;@misterduke&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;It's possibly due to the renaming of inputs.conf. Once you rename the inputs.conf and restart splunk , splunk does not know about monitor configurations and it just ignores the files.&lt;/P&gt;&lt;P&gt;For your use case, instead of removing the inputs.conf which has monitor stanza :&amp;nbsp;&lt;/P&gt;&lt;P&gt;Either you can split the inputs conf and keep the monitor stanza in a permanent conf in separate app context or local inputs&lt;/P&gt;&lt;P&gt;Or&lt;/P&gt;&lt;P&gt;Use/create a separate dummy "lock" file as soon as you perform the necessary actions. Then include a condition in your script to check for the presence of this file before performing the action, ie. no action if the file is present.&lt;/P&gt;&lt;P&gt;It all depends on how often you need to perform the passwd file change.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 11:12:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Universal-Forwarder-doesn-t-forward-specific-log/m-p/507808#M86420</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-07-07T11:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Universal Forwarder doesn't forward specific log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Universal-Forwarder-doesn-t-forward-specific-log/m-p/507868#M86434</link>
      <description>&lt;P&gt;okay I've split the inputs.conf. one with the monitor stanza in default and one with the scripted input in local.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the script does mv the inputs.conf in local into backupinput after all other loops are good.&amp;nbsp;&lt;/P&gt;&lt;P&gt;the thing I've noticed is:&lt;BR /&gt;&lt;BR /&gt;my script runs fine and changes the passwd just as I want and writes the echo in my log file. still, my splunk doesn't get any new input. BUT when I manually vim into the log file and write down "test test" for instance - immediately it appears in my splunk.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 15:22:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Universal-Forwarder-doesn-t-forward-specific-log/m-p/507868#M86434</guid>
      <dc:creator>misterduke</dc:creator>
      <dc:date>2020-07-07T15:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Universal Forwarder doesn't forward specific log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Universal-Forwarder-doesn-t-forward-specific-log/m-p/508034#M86453</link>
      <description>&lt;P&gt;Now I've drilled down the problem:&lt;/P&gt;&lt;P&gt;- in my scripted input, the bash script has to , after all changes, restart splunk&lt;/P&gt;&lt;P&gt;- the restart doesn't work because it also kills the process the script needs to function. so it stops splunk, therefore kills the processes and that's it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question: how can I restart splunk after my script did all the changes?&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 10:44:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Universal-Forwarder-doesn-t-forward-specific-log/m-p/508034#M86453</guid>
      <dc:creator>misterduke</dc:creator>
      <dc:date>2020-07-08T10:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Universal Forwarder doesn't forward specific log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Universal-Forwarder-doesn-t-forward-specific-log/m-p/508113#M86468</link>
      <description>&lt;P&gt;Ok, I solved the Problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to restart Splunk via scripted Input I need to use this in my script:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/opt/splunkforwarder/bin/splunk restart &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;without /dev/null 2&amp;gt;&amp;amp;1 it results in stopping splunk but not starting again.&amp;nbsp; Therefore not forwarding my logs&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 14:44:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Universal-Forwarder-doesn-t-forward-specific-log/m-p/508113#M86468</guid>
      <dc:creator>misterduke</dc:creator>
      <dc:date>2020-07-08T14:44:03Z</dc:date>
    </item>
  </channel>
</rss>

