|
| 1 | +# Splunk Forwarder Repair Kit |
| 2 | +This kit was compilled based on common issues with Splunk deployments and managing idiosyncrasies that tend to naturally occur. |
| 3 | + |
| 4 | +## Using the app |
| 5 | +Given the use-cases listed above, you will likely have multiple copies of the app with different input enabled for each. In any case, the app should restart Splunk when it is installed as all of the inputs are designed to be run when the forwarder starts. |
| 6 | + |
| 7 | +It should be noted that if multiple copies of the app are created, the inputs.conf would need to be adjusted to account for the change in path for Windows Powershell scripts. |
| 8 | + |
| 9 | +Below is the default inputs file. This configuration is responsible for running the scripts each time the forwarder restarts except for the restart script. The restart script is on a cron for every 2 minutes and is designed to only trigger a restart under specific circumstances. |
| 10 | + |
| 11 | +``` |
| 12 | +### Restart scripts |
| 13 | +[script://./bin/restart.sh] |
| 14 | +disabled = 1 |
| 15 | +index = _internal |
| 16 | +sourcetype = restart:output |
| 17 | +interval = */2 * * * * |
| 18 | +source = restart_output |
| 19 | +
|
| 20 | +[powershell://restart] |
| 21 | +disabled = 1 |
| 22 | +index = _internal |
| 23 | +sourcetype = restart:output |
| 24 | +interval = */2 * * * * |
| 25 | +source = restart_output |
| 26 | +script = . "$SplunkHome\etc\apps\SplunkForwarderRepairKit\bin\restart.ps1" |
| 27 | +
|
| 28 | +### GUID regneration scripts |
| 29 | +[script://./bin/regenGUID.sh] |
| 30 | +disabled = 1 |
| 31 | +index = _internal |
| 32 | +sourcetype = regen_guid:output |
| 33 | +interval = -1 |
| 34 | +source = regen_guid_output |
| 35 | +
|
| 36 | +[powershell://regenGUID] |
| 37 | +disabled = 1 |
| 38 | +index = _internal |
| 39 | +sourcetype = regen_guid:output |
| 40 | +interval = -1 |
| 41 | +source = regen_guid_output |
| 42 | +script = . "$SplunkHome\etc\apps\SplunkForwarderRepairKit\bin\regenGUID.ps1" |
| 43 | +
|
| 44 | +### Host/Server correction scripts |
| 45 | +[script://./bin/hostCorrect.sh] |
| 46 | +disabled = 1 |
| 47 | +index = _internal |
| 48 | +sourcetype = host_rename:output |
| 49 | +interval = -1 |
| 50 | +source = host_rename_output |
| 51 | +
|
| 52 | +[powershell://hostCorrect] |
| 53 | +disabled = 1 |
| 54 | +index = _internal |
| 55 | +sourcetype = host_rename:output |
| 56 | +interval = -1 |
| 57 | +source = host_rename_output |
| 58 | +script = . "$SplunkHome\etc\apps\SplunkForwarderRepairKit\bin\hostCorrect.ps1" |
| 59 | +
|
| 60 | +### Local deploymentclient removal scripts |
| 61 | +[script://./bin/dsRemove.sh] |
| 62 | +disabled = 1 |
| 63 | +index = _internal |
| 64 | +sourcetype = ds_remove:output |
| 65 | +interval = -1 |
| 66 | +source = ds_remove_output |
| 67 | +
|
| 68 | +[powershell://dsRemove] |
| 69 | +disabled = 1 |
| 70 | +index = _internal |
| 71 | +sourcetype = ds_remove:output |
| 72 | +interval = -1 |
| 73 | +source = ds_remove_output |
| 74 | +script = . "$SplunkHome\etc\apps\SplunkForwarderRepairKit\bin\dsRemove.ps1" |
| 75 | +
|
| 76 | +### Admin password change scripts |
| 77 | +[script://./bin/pwchange.sh] |
| 78 | +disabled = 1 |
| 79 | +index = _internal |
| 80 | +sourcetype = pw_change:output |
| 81 | +interval = -1 |
| 82 | +source = pw_change_output |
| 83 | +
|
| 84 | +[script://.\bin\pwchange.bat] |
| 85 | +disabled = 1 |
| 86 | +index = _internal |
| 87 | +sourcetype = pw_change:output |
| 88 | +interval = -1 |
| 89 | +source = pw_change_output |
| 90 | +``` |
| 91 | + |
| 92 | +## Use-Cases |
| 93 | +1. Local deployment server configurations |
| 94 | +2. Inputs and server host name configurations |
| 95 | +3. Duplicate forwarder GUIDs |
| 96 | +4. Changing the default password (Version <= 7.1.0) |
| 97 | + |
| 98 | +###### Remove local deployment server configurations |
| 99 | +Early in a deployment of Splunk, local configurations could be used while getting fmailiar with how Splunk works. These configurations may last for a while and cause issues down the road like if a new deployment server is stood up or an IP address changes. |
| 100 | + |
| 101 | +This app contains scripts for Windows and Linux forwarders that will remove local configurations of "deploymentclient.conf" in favor of a coniguration that has been deployed from the deployment server. This allows for that configuration to only be controlled via the deployment server from that point forward. |
| 102 | + |
| 103 | +Windows - `dsRemove.ps1` |
| 104 | +\*Nix - `dsRemove.sh` |
| 105 | + |
| 106 | +###### Correct inputs/server hostname configurations |
| 107 | +Many times we've come across an envionment where hundreds of forwarders are reporting with the same name and forwarder GUID. This usually happens when an image template isn't properly maintained after a fowarder has been embedded in it. |
| 108 | + |
| 109 | +This app contains scripts for Windows and Linux forwarders that will determine if correction is necessary in the local "inputs.conf" and "server.conf" and correct them. The scripts are designed to only change what is needed and leave the rest of the files unchanged. |
| 110 | + |
| 111 | +Windows - `hostCorrect.ps1` |
| 112 | +\*Nix - `hostCorrect.sh` |
| 113 | + |
| 114 | +###### Regenerate forwarder GUID |
| 115 | +Another by-product of the previous use-case is forwarder GUIDs all being the same. While this doesn't affect how a forwarder performs its duties, unique GUIDs ensures if hosts have the same name they are still uniquely idenitifiable for troubleshooting purposes. |
| 116 | + |
| 117 | +This app contains scripts for Windows and Linux forwarders that will move the existing "instance.cfg" to become a backup and restart the forwarder. Upon restarting, a new GUID will be generated. |
| 118 | + |
| 119 | +Windows - `regenGUID.ps1` |
| 120 | +\*Nix - `regenGUID.sh` |
| 121 | + |
| 122 | +###### Update default 'changeme' password on Splunk Forwarders (before 7.1.0) |
| 123 | +Forwarders deployed before version 7.1.0 didn't require the admin password be changed upon installation. Starting at 7.1.0, the forwarders required either a user-seed file or manual input of the password during first-time run. While the REST API of the fowrwarder is not configured to allow POST requests until the password is changed on versions prior to 7.1.0, changing the password is still recommended. |
| 124 | + |
| 125 | +This app contains scripts for Windows and Linux forwarders that will allow either a static password or random password to be configured. By default, a random password is generated and printed into the log which is sent back to Splunk. |
| 126 | + |
| 127 | +Windows - `pwchange.bat` |
| 128 | +\*Nix - `pwchange.sh` |
| 129 | + |
| 130 | +## Restarting the Forwarder |
| 131 | +Because most of these use-cases require the forwarders be restarted, an additional script has been introduced that takes the outcome of each of the scripts used and determines if a restart is required. Each script is designed to create an empty file that the restart script uses to determine if a restart is necessary. If the restart script finds one of the files used to trigger a restart, it removes them and should keep the system clean of unnecessary files. |
| 132 | + |
| 133 | +Windows - `restart.ps1` |
| 134 | +\*Nix - `restart.sh` |
0 commit comments