Skip to content

Commit

Permalink
Merge pull request #523 from splunk/feature/simplify-unitfiles
Browse files Browse the repository at this point in the history
Add SC4S_DEBUG_CONTAINER to prevent container exit on startup error
  • Loading branch information
Ryan Faircloth authored and GitHub committed Jun 14, 2020
2 parents 08fe79d + 61a0c9c commit 8c4b82e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
17 changes: 5 additions & 12 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,12 @@ and navigating the syslog-ng config filesystem directly. To do this, run
/usr/bin/podman exec -it SC4S /bin/bash
```
and navigate to `/opt/syslog-ng/etc/` to see the actual config files in use. If you are adept with container operations and syslog-ng
itself, you can also modify files directly and reload syslog-ng with the command `kill -1 1` in the container. This is an advanced topic
and futher help can be obtained via the github issue tracker and Slack channels.
itself, you can modify files directly and reload syslog-ng with the command `kill -1 1` in the container.
You can also run the `/entrypoint.sh` script by hand (or a subset of it, such as everything
but syslog-ng) and have complete control over the templating and underlying syslog-ng process.
This is an advanced topic and futher help can be obtained via the github issue tracker and Slack channels.

## Run the container with a null entrypoint (Advanced!)

You can run the container without the usual entrypoint shell script by executing this command (modified to suit your environment):

```bash
/usr/bin/podman run -p 514:514 -p 514:514/udp -p 5000-5020:5000-5020 -p 5000-5020:5000-5020/udp --entrypoint=tail --env-file=/opt/sc4s/env_file -v /opt/sc4s/local:/opt/syslog-ng/etc/conf.d/local:z --name SC4S --rm splunk/scs:latest -f /dev/null
```
From there, you can "exec" into the container (above) and run the `/entrypoint.sh` script by hand (or a subset of it, such as everything
but syslog-ng) and have complete control over the templating and underlying syslog-ng process. Again, this is an advanced topic but can be
very useful for low-level troubleshooting.
When debugging a configuration syntax issue at startup the container must remain running. This can be enabled by adding `SC4S_DEBUG_CONTAINER=yes` to the `env_file`.

## Dealing with non RFC-5424 compliant sources

Expand Down
8 changes: 7 additions & 1 deletion package/sbin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ sleep 5
if ! ps -p $pid > /dev/null
then
echo "syslog-ng failed to start $pid is not running"
exit $(wait ${pid})
/opt/syslog-ng/sbin/syslog-ng -s
if [ "${SC4S_DEBUG_CONTAINER}" == "yes" ]
then
exit $(wait ${pid})
else
tail -f /dev/null
fi
# Do something knowing the pid exists, i.e. the process with $PID is running
fi

Expand Down

0 comments on commit 8c4b82e

Please sign in to comment.