如何在CentOS 7上安装Splunk

时间:2020-03-05 15:28:13  来源:igfitidea点击:

Splunk是探索和搜索数据最强大的工具之一。
它是搜索,分析,收集和可视化大量数据流的最简单,更快,安全的方法之一,实时从应用程序,WebServers,数据库,服务器平台,云网络等等。
Splunk开发人员正在在不同平台上提供兼容的Splunk软件包,我们可以选择适合我们目的的最佳选择。
该软件使得在任何IT企业,安全系统或者任何业务应用程序生成的大规模数据的联合国带法值时,可以简单地收集,分析和工作,从而为我们提供最佳操作表现和业务成果的全面见解。

安装中没有官方准备工作,但我建议在安装之前为服务器提供适当的主机名,防火墙和网络配置。
该软件仅支持64位服务器体系结构。
在本文中,我正在指导我们如何在CentOS 7服务器上安装Splunk Enterprise版本。
让我们逐一走过安装步骤。

1.创建一个Splunk用户

始终建议将此应用程序作为其专用用户而不是作为root。
我创建了一个用户来运行此应用程序,并为安装创建了一个应用程序文件夹。

[root@server1 tmp]# groupadd splunk
[root@server1 tmp]# useradd -d /opt/splunk -m -g splunk splunk
[root@server1 tmp]# su - splunk
[splunk@server1 ~]$id
uid=1001(splunk) gid=1001(splunk) groups=1001(splunk)
Confirm the server architecture
[splunk@server1 ~]$getconf LONG_BIT
64

2.下载并提取Splunk Enterprise版本

创建一个Splunk帐户并在此处从官方下载Splunk软件。

现在提取Tar文件并将文件复制到Splunk应用程序文件夹中,即/opt/splunk创建。

root@server1 tmp]# tar -xvf splunk-6.4.0-f2c836328108-Linux-x86_64.tgz
[root@server1 tmp]# cp -rp splunk/* /opt/splunk/
[root@server1 tmp]# chown -R splunk: /opt/splunk/

3. Splunk安装

下载了Splunk软件后,我们可以登录Splunk用户并运行安装脚本。
我选择试用许可证,因此默认情况下它会采用它。

root@server1 tmp]# su - splunk
Last login: Fri Apr 29 08:14:12 UTC 2015 on pts/0
[splunk@server1 ~]$cd bin/
[splunk@server1 bin]$./splunk start --accept-license
This appears to be your first time running this version of Splunk.
Copying '/opt/splunk/etc/openldap/ldap.conf.default' to '/opt/splunk/etc/openldap/ldap.conf'.
Generating RSA private key, 1024 bit long modulus
.++++++
..................++++++
e is 65537 (0x10001)
writing RSA key
Generating RSA private key, 1024 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> Australian for grep.
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/spool/splunk
Creating: /opt/splunk/var/spool/dirmoncache
Creating: /opt/splunk/var/lib/splunk/authDb
Creating: /opt/splunk/var/lib/splunk/hashDb
Checking critical directories... Done
Checking indexes...
Validated: _audit _internal _introspection _thefishbucket history main summary
Done
New certs have been generated in '/opt/splunk/etc/auth'.
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-6.4.0-f2c836328108-linux-2.6-x86_64-manifest'
All installed files intact.
Done
All preliminary checks passed.
Starting splunk server daemon (splunkd)...
Generating a 1024 bit RSA private key
.....................++++++
...........................++++++
writing new private key to 'privKeySecure.pem'
----
Signature ok
subject=/CN=server1.centos7-test.com/O=SplunkUser
Getting CA Private Key
writing RSA key
Done
[ OK ]
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://server1.centos7-test.com:8000

现在,我们可以在http://ip:8000 /或者http://hostname:8000访问Splunk Web界面。
我们需要确保在服务器防火墙中打开此端口8000。

4.配置Splunk Web界面

我已经完成了我的安装,我在我的服务器上运行了我的Splunk Service。
现在我需要设置我的splunk web界面。
我访问了Splunk Web界面并设置了我的管理员密码。

第一次访问Splunk接口时,我们可以在此情况下使用页面中提供的用户/密码。
登录后,在下一页上,它会要求更改并确认新密码。

现在,我们可以设置管理员密码。
使用新密码登录后,我们将使用Splunk仪表板准备使用。

主页上有不同的类别。
我们可以选择所需的一个并启动Splunking。

6.添加任务

我正在为一个简单的任务添加一个例子,该任务被添加到Splunk系统。
只需看到我的快照即可了解如何添加它。
我的任务是将/var/log文件夹添加到Splunk系统以进行监视。

  • 打开Splunk Web界面。单击"设置"选项卡>>选择"添加数据"选项

2."添加数据"选项卡与三个选项打开:上传,监视器和转发。
其中我们的任务是监视文件夹,因此我们继续监视器。

在监视器选项中,有四类如下:

文件和目录:监视文件/文件夹

HTTP事件收集器:通过HTTP监视数据流

TCP/UDP:监视服务端口

脚本:监视脚本

3.根据我们的目的,我选择文件和目录选项。

4.现在,我正在选择来自服务器的确切文件夹路径来监视。
使用设置确认后,我们可以单击下一步并查看。

5.现在我们可以根据需要开始搜索和监视日志文件。