zoukankan      html  css  js  c++  java
  • Splunk作为日志分析平台与Ossec进行联动

    背景:

      Ossec安装后用了一段时间的analogi作为ossec的报警信息显示平台,但是查看报警分类信息、

    以及相关图标展示等方面总有那么一点点的差强人意,难以分析。因此使用逼格高一点的splunk作为

    日志分析平台就变得很有必要了。

    操作:

     一、ossec服务端配置

      (1)配置ossec数据转发至splunk监听端口

        [root@localhost html]# vim /opt/ossec/etc/ossec.conf

      在<ossec_config>标签下添加<syslog_output>,内容如下,

      其中server标签的IP为接受syslog记录的服务端,即安装splunk服务的主机IP。

      端口为splunk的本地监听端口。

      <syslog_output>
        <server>192.168.129.134</server>
        <port>10002</port>
      </syslog_output>

      (2)使syslog_output模块生效并重启ossec服务端。

    [root@localhost html]# /opt/ossec/bin/ossec-control enable client-syslog
    [root@localhost html]# /opt/ossec/bin/ossec-control restart

     二、下载并安装splunk

      (1)从官网下载splunk(需注册),下载文件为splunklight-6.4.2-00f5bb3fa822-linux-2.6-x86_64.rpm

      (2)安装splunk:rpm -Uvh splunklight-6.4.2-00f5bb3fa822-linux-2.6-x86_64.rpm

    [root@localhost Desktop]# rpm -Uvh splunklight-6.4.2-00f5bb3fa822-linux-2.6-x86_64.rpm 
    warning: splunklight-6.4.2-00f5bb3fa822-linux-2.6-x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 653fb112: NOKEY
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:splunk-6.4.2-00f5bb3fa822        ################################# [100%]
    complete

      (3)启动splunk:# /opt/splunk/bin/splunk start (启动时会询问是否同意许可,输入y后继续)

    [root@localhost Desktop]# /opt/splunk/bin/splunk start
    
    ... ...
    
    4. FORCE MAJEURE. Splunk will not be responsible for any failure or delay in its
    performance under these Terms and Conditions due to causes beyond its reasonable
    control, including, but not limited to, labor disputes, strikes, lockouts,
    shortages of or inability to obtain labor, energy, raw materials or supplies,
    war, acts of terror, riot, acts of God or governmental action.
    Do you agree with this license? [y/n]:   y

    ... ...

      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://127.0.0.1:8000

      (4)Splunk的web接口为http://127.0.0.1:8000,尝试访问。

      (5)首次登录请先按着提示输入admin/changeme后,设定新的密码。之后的登录信息为admin+你设定的新密码。

      (6)登录成功

     三、配置Splunk接收来自Ossec的日志转发

      (1)splunk的默认安装路径为/opt/splunk,编辑/opt/splunk/etc/system/local/inputs.conf文件添加以下红色字体内容

        指定的ip为ossec服务器的IP地址。

    [root@localhost local]# vim /opt/splunk/etc/system/local/inputs.conf 
    
    [default]
    host = localhost.localdomain
    
    [udp://192.168.129.128:10002] # IP address of OSSEC server
    disabled = false
    sourcetype = ossec

      (2)重启Splunk服务

    # /opt/splunk/bin/splunk restart

     四、Splunk数据导入

      (1)导入页面

      

     数据已成功导入

  • 相关阅读:
    如何在tomcat安装部署php项目
    十大建站开源程序
    虚拟主机、VPS、云主机以及独立服务器的关系
    heritrix启动问题修正
    网页布局:float与position的区别
    C#中利用委托实现多线程跨线程操作
    Java Service Wrapper配置详解
    Windows7部署WordPress傻瓜式教程(IIS7.5+MySQL+PHP+WordPress)
    关于favicon.ico的使用
    使用JAVA对字符串进行DES加密解密(修正问题)
  • 原文地址:https://www.cnblogs.com/tdcqma/p/5695945.html
Copyright © 2011-2022 走看看