Кратко задокументирую себе еще один небольшой черновик – как выполняется установка Splunk. Это довольно типовой сценарий, и он отлично подойдет под тестовые стенды или подготовку среды для тестового контура.
Описание окружения
Операционная система: CentOS Stream 9
Версия Splunk: Splunk 7.3.9 Free
Установка Splunk
Для установки Splunk необходимо выполнить следующие шаги:
2. Скопировать установщик на сервер. Я использую scp:
scp splunk-7.3.9-39a78bf1bc5b-Linux-x86_64.tgz roman@10.10.10.27:/home/roman

3. Распаковываем архив:
tar -xvzf splunk-7.3.9-39a78bf1bc5b-Linux-x86_64.tgz
4. Переносим рапакованную директорию в /opt:
sudo cp -r splunk /opt
5. Запускаем первоначальную установку Splunk:
cd /opt/splunk/bin
sudo ./splunk start --accept-license
This appears to be your first time running this version of Splunk.
Splunk software must create an administrator account during startup. Otherwise, you cannot log in.
Create credentials for the administrator account.
Characters do not appear on the screen when you type in credentials.
Please enter an administrator username: spuser
Password must contain at least:
* 8 total printable ASCII character(s).
Please enter a new password:
Please confirm new password:
Copying '/opt/splunk/etc/openldap/ldap.conf.default' to '/opt/splunk/etc/openldap/ldap.conf'.
Generating RSA private key, 2048 bit long modulus
................+++++
...................+++++
e is 65537 (0x10001)
writing RSA key
Generating RSA private key, 2048 bit long modulus
...............................................................+++++
.........................................................................................+++++
e is 65537 (0x10001)
writing RSA key
Moving '/opt/splunk/share/splunk/search_mrsparkle/modules.new' to '/opt/splunk/share/splunk/search_mrsparkle/modules'.
Splunk> Take the sh out of IT.
Checking prerequisites...
Checking http port [8000]: open
Checking mgmt port [8089]: open
Checking appserver port [127.0.0.1:8065]: open
Checking kvstore port [8191]: open
Checking configuration... Done.
Creating: /opt/splunk/var/lib/splunk
Creating: /opt/splunk/var/run/splunk
Creating: /opt/splunk/var/run/splunk/appserver/i18n
Creating: /opt/splunk/var/run/splunk/appserver/modules/static/css
Creating: /opt/splunk/var/run/splunk/upload
Creating: /opt/splunk/var/run/splunk/search_telemetry
Creating: /opt/splunk/var/spool/splunk
Creating: /opt/splunk/var/spool/dirmoncache
Creating: /opt/splunk/var/lib/splunk/authDb
Creating: /opt/splunk/var/lib/splunk/hashDb
New certs have been generated in '/opt/splunk/etc/auth'.
Checking critical directories... Done
Checking indexes...
Validated: _audit _internal _introspection _telemetry _thefishbucket history main summary
Done
Checking filesystem compatibility... Done
Checking conf files for problems...
Done
Checking default conf files for edits...
Validating installed files against hashes from '/opt/splunk/splunk-7.3.9-39a78bf1bc5b-linux-2.6-x86_64-manifest'
All installed files intact.
Done
All preliminary checks passed.
Starting splunk server daemon (splunkd)...
Generating a RSA private key
............+++++
........................................................................................+++++
writing new private key to 'privKeySecure.pem'
-----
Signature ok
subject=/CN=splunk/O=SplunkUser
Getting CA Private Key
writing RSA key
Done
Waiting for web server at http://127.0.0.1:8000 to be available.. Done
If you get stuck, we're here to help.
Look for answers here: http://docs.splunk.com
The Splunk web interface is at http://splunk:8000

Сразу после установки Splunk будет доступен вот по этому адресу (с самого хоста):
http://localhost:8000

Настройка после установки
После установки я выполнил первоначальную настройку следующим образом:
1. Останавливаем текущий экземпляр:
cd /opt/splunk/bin
sudo ./splunk stop
Stopping splunkd...
Shutting down. Please wait, as this may take a few minutes.
..
Stopping splunk helpers...
Done.

2. Настраиваем запуск в качестве сервиса:
cd /opt/splunk/bin
sudo ./splunk enable boot-start -systemd-managed 1 -user root -group root
Warning: cannot create "/opt/splunk/var/log/splunk"
Warning: cannot create "/opt/splunk/var/log/introspection"
Warning: cannot create "/opt/splunk/var/log/watchdog"
Systemd unit file installed at /etc/systemd/system/Splunkd.service.
Configured as systemd managed service.

Для повышения изолированности и безопасности сервиса вы можете настроить запуск от отдельной учетной записи пользователя. Для моей демонстрационной среды этого не требовалось.
3. В моем случае для того, чтобы сервис запустился корректно пришлось немного отредактировать конфигурационный файл юнита:
sudo nano /etc/systemd/system/Splunkd.service
#This unit file replaces the traditional start-up script for systemd
#configurations, and is used when enabling boot-start for Splunk on
#systemd-based Linux distributions.
[Unit]
Description=Systemd service file for Splunk, generated by 'splunk enable boot-start'
After=network.target
[Service]
Type=simple
Restart=always
ExecStart=/opt/splunk/bin/splunk _internal_launch_under_systemd
LimitNOFILE=65536
SuccessExitStatus=51 52
RestartPreventExitStatus=51
RestartForceExitStatus=52
User=root
Delegate=true
CPUShares=1024
MemoryLimit=3802157056
PermissionsStartOnly=true
#ExecStartPost=/bin/bash -c "chown -R 1001:1001 /sys/fs/cgroup/cpu/system.slice/%n"
#ExecStartPost=/bin/bash -c "chown -R 1001:1001 /sys/fs/cgroup/memory/system.slice/%n"
[Install]
WantedBy=multi-user.target

Сохраняем внесенные изменения.
4. Перечитываем определения для юнитов и запускаем сервис:
sudo systemctl daemon-reload
sudo systemctl enable Splunkd
sudo systemctl start Splunkd
5. Смотрим статус:
sudo systemctl status Splunkd
● Splunkd.service - Systemd service file for Splunk, generated by 'splunk enable boot-start'
Loaded: loaded (/etc/systemd/system/Splunkd.service; enabled; preset: disabled)
Active: active (running) since Sat 2024-10-19 17:43:08 MSK; 9s ago
Main PID: 2107 (splunkd)
Tasks: 169 (limit: 22799)
Memory: 518.7M (limit: 3.5G)
CPU: 3.534s
CGroup: /system.slice/Splunkd.service
├─2107 splunkd --under-systemd --systemd-delegate=yes -p 8089 _internal_launch_under_systemd
├─2149 "[splunkd pid=2107] splunkd --under-systemd --systemd-delegate=yes -p 8089 _internal_launch_under_systemd [>
├─2163 mongod --dbpath=/opt/splunk/var/lib/splunk/kvstore/mongo --storageEngine=mmapv1 --port=8191 --timeStampForm>
├─2236 /opt/splunk/bin/python -O /opt/splunk/lib/python2.7/site-packages/splunk/appserver/mrsparkle/root.py --prox>
└─2355 /opt/splunk/bin/splunkd instrument-resource-usage -p 8089 --with-kvstore
Oct 19 17:43:09 splunk splunk[2128]: Checking critical directories... Done
Oct 19 17:43:09 splunk splunk[2128]: Checking indexes...
Oct 19 17:43:09 splunk splunk[2128]: Validated: _audit _internal _introspection _telemetry _thefishbucket histo>
Oct 19 17:43:09 splunk splunk[2128]: Done
Oct 19 17:43:09 splunk splunk[2107]: Checking filesystem compatibility... Done
Oct 19 17:43:09 splunk splunk[2107]: Checking conf files for problems...
Oct 19 17:43:09 splunk splunk[2107]: Done
Oct 19 17:43:09 splunk splunk[2107]: Checking default conf files for edits...
Oct 19 17:43:09 splunk splunk[2107]: Validating installed files against hashes from '/opt/splunk/splunk-7.3.9-39a78bf1b>
Oct 19 17:43:10 splunk splunk[2107]: 2024-10-19 17:43:10.167 +0300 splunkd started (build 39a78bf1bc5b) pid=2107

6. Добавляем правило в брандмауэр:
sudo firewall-cmd --add-port=8000/tcp --permanent
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --reload
7. Теперь в настройках Splunk включим использование SSL сертификата:
http://10.10.10.27:8000/en-US/manager/launcher/server/settings/settings?action=edit

Сохраняем изменения.
8. Перезапускаем сервис:
sudo systemctl restart Splunkd
Проверка
Выполняем последнюю проверку:
https://10.10.10.27

Пример главного дашборда после запуска системы:

Установка Splunk в базовой конфигурации завершена.
Установка Splunk: 2 комментария
1. Будут ли ещё статья по настройке Splunk ?
2. Почему выбрали версию Splunk 7.3.9 а не 9,3,1 ?
Добрый день!
1. Маловероятно, если только какие-то еще шпаргалки мне не понадобятся.
2. Несколько раз на практике была необходимость в установке именной этой версии. Чтобы повторные установки были проще как раз и сделал краткий гайд.