• Splunk安装部署基础篇


    Splunk安装(以4.3.4版本为例)

    下载splunk软件包,并解压,直接启动即可。

    tar -zxvf splunk-4.3.4-136012-Linux-x86_64.tgz -C /opt
    cd /opt/splunk/bin
    ./splunk start

    设置开机启动:$SPLUNK_HOME/bin/splunk enable boot-start

    检查服务状态:

    tcp        0      0 0.0.0.0:18000               0.0.0.0:*                   LISTEN      0          553112836  28537/splunkd
    tcp        0      0 0.0.0.0:8089                0.0.0.0:*                   LISTEN      0          553112134  28537/splunkd

    Web端口默认8000,浏览器访问:http://192.168.1.2408000

    默认账号:admin/changeme

    Splunk 分索引器和转发器。类似Server和client的概念。 转发器将本地应用日志生成索引发往服务端。日志统一在服务器侧查看。

    Splunk索引器(Server)

    设置接受splunk forwarder发送来的数据.

    管理器 » 转发和接收 » 接收数据 » 新增

    新增服务端监听端口,(用于转发器配置转发地址 IP:Port)

     Splunk forwarder客户端

    1. 当Splunk配置为转发器时,切换成相应的许可证类型。

    2. 转发器侧配置服务端地址(IP:Port)

    管理器 » 转发和接收 » 转发数据 » 新增

     

    命令行操作

    1)添加/删除/查看splunk forward-server

    # ./splunk add forward-server 192.168.1.1:18000
    Added forwarding to: 192.168.1.1:18000.
    # ./splunk list forward-server
    Active forwards:
        None
    Configured but inactive forwards:
        192.168.1.1:18000
    # ./splunk remove forward-server 192.168.1.1:18000
    Stopped forwarding to: 192.168.1.1:18000.
    # ./splunk list forward-server
    Active forwards:
        None
    Configured but inactive forwards:
        None

     2)配置需要监控的日志文件

    # cd /opt/splunkforwarder/etc/system/local
    # vim inputs.conf
    [default]
    host = newtest
    
    [monitor:///usr/local/nginx/logs/error.log]
    disabled = false
    index = main
    sourcetype = nginx_error
    
    # /opt/splunkforwarder/bin/splunk start
    著作权归作者所有。
    商业转载请联系作者获得授权,非商业转载请注明出处。
    作者:gjc159357
    链接:http://www.89cool.com/374.html
    来源:http://www.89cool.com/

    cd bin/ ps aux | grep splunk ./splunk add forward-server 198.46.145.77:9997 ./splunk add forward-server 198.46.145.77:9997 -auth admin:changeme ./splunk list forward-server
    ./splunk list monitor ./splunk add monitor /home/logs/access.log (添加监控日志) ./splunk add monitor /home/logs/cache.log (同上)

    注意,修改配置文件后,需要重启splunk forwarder。

    小技巧将不同服务器的同类型日志,指定为同一个sourcetype,则可以通过“来源类型”选项卡合并查看。

    参考:http://www.cnblogs.com/lmgsanm/p/5398308.html

    https://www.splunk.com/zh-hans_cn/view/education/SP-CAAAAH9

  • 相关阅读:
    Node.js v0.10.1 稳定版发布
    PHP 5.5.0 Alpha6 发布
    DataNucleus Access Platform 3.2 正式版发布
    Swipe 2.0 发布,移动端滑动 JS 库
    Kamailio 4.0 发布,开源的SIP服务器
    PeerJS 0.1.7:一个用于浏览器内P2P的WebRTC封装器
    Apache Libcloud 0.12.3 发布
    IE 10将加强对Flash的支持
    JBoss Portlet Bridge 3.2.0.Beta2 发布
    如何在遗留代码基础上开发
  • 原文地址:https://www.cnblogs.com/zihanxing/p/6868619.html
Copyright © 2020-2023  润新知