0

我刚刚在 Windows 上构建了一个 ELK 服务器,所以我是这个过程的新手。我已通读文档,但无法解析我的 IIS 高级日志,尤其是 x-forwarded-for 数据,因为我们位于负载均衡器后面。

我的高级日志记录设置为输出如下数据:

$date,  $time,  $s-ip,  $cs-uri-stem, $cs-uri-query, $s-port, $cs-username, $c-ip,  $X-Forwarded-For, $csUser-Agent, $cs-Referer, $sc-status, $sc-substatus, $sc-win32-status, $time-taken

我这样设置我的 logstash.conf:

input {
  tcp {
      host => "localhost"
          type => "iis"
          port => 5044 

  }
}
filter {
    if [type] == "iis" {
        grok {
            match => {"message" => "%{TIMESTAMP_ISO8601:log_timestamp} %{IPORHOST:site} %{URIPATH:page} %{NOTSPACE:query_string} %{NUMBER:port} %{NOTSPACE:username} %{IPORHOST:client_host} %{NOTSPACE:useragent} %{NOTSPACE:referer} %{GREEDYDATA:response} %{NUMBER:httpStatusCode:int} %{NUMBER:scSubstatus:int} %{NUMBER:scwin32status:int} %{NUMBER:timeTakenMS:int}"}
        }
    }
}
output {
  elasticsearch {
        hosts => ["localhost:9200"]
        index => "iis"
        document_type => "main"
  }
}

我不认为这是正确的,因为我没有得到数据。我已经搜索了文档,但仍然遇到问题,并且不确定是否需要采取其他步骤,例如映射字段。

我目前正在使用来自一台服务器的 filebeat 将数据推送到我的 ELK 服务器。我不确定这是否也是最好的方法(也许是 nxlog?)。我们不想在客户端机器上安装 logstash。

有人可以帮帮我吗?这将不胜感激!!

谢谢,乔治

4

1 回答 1

0

由于您使用的是 Filebeat,因此您需要使用 beats 输入而不是 tcp 输入。请参阅有关如何为 Beats 设置 Logstash的文档。

本质上,您需要将 tcp 输入替换为:

input {
  beats {
    port => 5044
  }
}

在您的 Filebeat 配置文件中,将 设置document_typeiis以便您的过滤条件匹配。

filebeat:
  prospectors:
    - paths:
        - 'C:\path\to\your\iis\logs\*.log'
      document_type: iis
于 2016-07-13T15:15:27.233 回答