Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Logging rsyslog将日志文件转发给elasticsearch_Logging_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Rsyslog - Fatal编程技术网 elasticsearch,rsyslog,Logging,elasticsearch,Rsyslog" /> elasticsearch,rsyslog,Logging,elasticsearch,Rsyslog" />

Logging rsyslog将日志文件转发给elasticsearch

Logging rsyslog将日志文件转发给elasticsearch,logging,elasticsearch,rsyslog,Logging,elasticsearch,Rsyslog,我遇到了一些困难,需要一个非常基本的rsyslog操作才能正常工作。我希望它抓取一个文件并使用elasticsearch模块转发它。不幸的是,我不知道如何通过规则集将输入与操作绑定 module(load="imfile" PollingInterval="10") module(load="omelasticsearch") template(name="logstash-index" type="list") { constant(value="logstash-")

我遇到了一些困难,需要一个非常基本的rsyslog操作才能正常工作。我希望它抓取一个文件并使用elasticsearch模块转发它。不幸的是,我不知道如何通过规则集将输入与操作绑定

module(load="imfile" PollingInterval="10")
module(load="omelasticsearch")

template(name="logstash-index"
  type="list") {
    constant(value="logstash-")
    property(name="timereported" dateFormat="rfc3339" position.from="1" position.to="4")
    constant(value=".")
    property(name="timereported" dateFormat="rfc3339" position.from="6" position.to="7")
    constant(value=".")
    property(name="timereported" dateFormat="rfc3339" position.from="9" position.to="10")
}

template(name="plain-syslog"
  type="list") {
    constant(value="{")
      constant(value="\"@timestamp\":\"")     property(name="timereported" dateFormat="rfc3339")
      constant(value="\",\"host\":\"")        property(name="hostname")
      constant(value="\",\"severity\":\"")    property(name="syslogseverity-text")
      constant(value="\",\"facility\":\"")    property(name="syslogfacility-text")
      constant(value="\",\"tag\":\"")   property(name="syslogtag" format="json")
      constant(value="\",\"message\":\"")    property(name="msg" format="json")
    constant(value="\"}")
}

ruleset (name="somename") {
action(type="omelasticsearch"
    template="plain-syslog"
    searchIndex="logstash-index"
    server="10.10.10.5"
    serverport="9200"
    bulkmode="on"
    queue.type="linkedlist"
    queue.size="5000"
    queue.dequeuebatchsize="300"
    action.resumeretrycount="-1"
    dynSearchIndex="on")
}

input(type="imfile"
      File="/var/log/haproxy.log"
      Tag="haproxy"
      StateFile="state-haproxy"
      Severity="notice"
      escapelf="on"
      readMode="2"
      Facility="local7"
      ruleset="somename")
有知识的人可以修复我的代码尝试吗(并且可能显示一个同时转发多个文件的示例?)

另外,我让它工作的一种方法是,引导服务(haproxy)登录到local7(例如),然后将rsyslog操作绑定到local7.*,但这只是一种临时解决方法,因为我需要能够转发文件