-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint-splunk.sh
executable file
·80 lines (59 loc) · 1.63 KB
/
entrypoint-splunk.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
#
# Script to run from Splunk
#
TZ="${TZ:=EST5EDT}"
if test ! "$SPLUNK_PASSWORD"
then
echo "! "
echo "! You need to specify a default Splunk password in the SPLUNK_PASSWORD variable to continue!"
echo "! "
exit 1
elif test "$SPLUNK_PASSWORD" == "password"
then
echo "! "
echo "! Seriously? Your Splunk password is 'password'!?"
echo "! "
echo "! Nope, we're not doing this. I'm sorry, but if you're going to put "
echo "! a Splunk instance on the Internet, I need you to choose a better password."
echo "! "
echo "! Try https://diceware.dmuth.org/ if you need help creating a password that's easy to remember. :-)"
echo "! "
echo "! "
exit 1
fi
#
# Set our default password
#
pushd /opt/splunk/etc/system/local/ >/dev/null
cat user-seed.conf.in | sed -e "s/%password%/${SPLUNK_PASSWORD}/" > user-seed.conf
cat web.conf.in | sed -e "s/%password%/${SPLUNK_PASSWORD}/" > web.conf
popd > /dev/null
if test -f /mnt/docker/splunk-config/passwd
then
echo "# "
echo "# Splunk passwd file found, importing that into Splunk!"
echo "# "
cp /mnt/docker/splunk-config/passwd /opt/splunk/etc/
fi
#
# Start Splunk
#
/opt/splunk/bin/splunk start --accept-license
echo "# "
echo "# Available env vars: TZ, SPLUNK_PASSWORD"
echo "# "
echo "# "
echo "# If your data is not persisted, be sure you ran this container with: "
echo "# "
echo "# -v \$(pwd)/data:/opt/splunk/var/lib/splunk/defaultdb"
echo "# "
echo "# Timezone in UTC? Specify your timezone with -e, such as:"
echo "# "
echo "# -e TZ=EST5EDT"
echo "# "
echo "# "
#
# Tail this file so that Splunk keeps running
#
tail -f /opt/splunk/var/log/splunk/splunkd_stderr.log