[英]Missing data between Logstash and ElasticSearch
我正在嘗試使用Logstash解析IIS錯誤XML文件,然后將這些錯誤存儲在Elasticsearch中並顯示在Kibana中。
這是我的logstash.conf文件:
input
{
file{
path => ["C:/inetpub/logs/FailedReqLogFiles/*/*.xml"]
start_position => "beginning"
# filter is not thread safe, so have to move the multiline into the input
codec => multiline{
#pattern => "^</failedRequest>"
pattern => "^<\?xml version"
negate => true
what => "previous"
max_lines => 12000
}
sincedb_path => "C:/Users/ss/Source/elk/logstash/bin/.sincedb"
}
}
filter{
xml{
store_xml => "false"
source => "message"
target => "EVENT"
xpath => [
"/failedRequest/@url", "url",
"/failedRequest/@appPoolId", "appPoolId",
"/failedRequest/@verb", "verb",
"/failedRequest/@statusCode", "statusCode"
]
}
}
output
{
elasticsearch{
hosts => ["100.202.191.77:9200"]
index => "testserver-logstash"
flush_size => 1
}
stdout
{
codec => rubydebug
}
file{
path => "C:/Users/ss/Source/elk/logstash/bin/test.log"
}
}
日志文件目錄為:
C:\inetpub\logs\FailedReqLogFiles\W3SVC3
C:\inetpub\logs\FailedReqLogFiles\W3SVC4
C:\inetpub\logs\FailedReqLogFiles\W3SVC5
這些目錄中包含的日志文件包括:fr000001.xml,fr000002.xml,fr000003.xml,fr000004.xml等。
xml文件的結構如下:
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type='text/xsl' href='freb.xsl'?>
<!-- saved from url=(0014)about:internet -->
<failedRequest url="https://aaa.bbb.com:443/ddd.aspx"
siteId="3"
appPoolId="aaa.bbb.com"
processId="15168"
verb="GET"
remoteUserName=""
userName=""
tokenUserName="NT AUTHORITY\IUSR"
authenticationType="anonymous"
activityId="{00000000-0000-0000-0200-0080030000FF}"
failureReason="STATUS_CODE"
statusCode="500"
triggerStatusCode="500"
timeTaken="368584"
xmlns:freb="http://schemas.microsoft.com/win/2006/06/iis/freb"
>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">blablabla
</Event>
</failedRequest>
我得到的問題是:總共有13個xml日志文件。 我可以在標准輸出和test.log中看到logstash輸出正確打印了所有這13個文件的已解析xml,但是,在Kibana中,我只能看到13個xml文件中的4個的數據,其余9個文件是失蹤。
我是ELK堆棧的新手,真的被卡在這里。 希望有人可以幫助我。 提前致謝。
我下線評論,它看起來像logstash工作。
flush_size => 1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.