Filebeat 多行过滤器不适用于 txt 文件
Filebeat multiline filter doesn't work with txt file
我使用 filebeat 从 .txt 收集数据file.I正在尝试使用 Filebeat 多行功能,使用以下 Filebeat 配置将日志行合并为一个条目:
filebeat.inputs:
- type: filestream
enabled: true
multiline.pattern: '^[0-9]{2}\/[0-9]{2}\/[0-9]{4}'
multiline.negate: true
multiline.match: after
paths:
- .\My.log
output.logstash:
hosts: ["localhost:5044"]
这是一个日志示例。我想合并堆栈跟踪日志。
18/11/2021 19:17:25,717 [96] ERROR B2XPPA.Web.UI.Utilities.GlobalExceptionFilter -
System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at B2X.AddressRestfulAPIClient.RestfulWebAPIClient.GetDetails(String url)
at B2X.AddressValidation.AddressValidation.GetEircodeAddress(String Eircodeid)
at B2XPPA.Web.UI.Services.DropdownsPPAService.GetEircodeAddress(String eirCodeId)
at B2XPPA.Web.UI.Models.Populators.PPADetailsPopulator.Populate(IViewModel viewModel, Quote quote)
at B2X.Services.ApplicationService.Application`1.PopulateDetailsView(DetailsViewModel viewModel, String referenceNumberInController, Quote quote)
at B2XPPA.Web.UI.Controllers.QuoteController.Create(QuoteDetailsViewModel viewModel)
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
但是,Kibana 中的所有日志继续在每个新行处分开,并且根本没有发生多行格式化。谁能帮我解决这个问题?
您的多行模式与任何内容都不匹配。
模式 ^[0-9]{4}-[0-9]{2}-[0-9]{2}
期望您的行以 dddd-dd-dd
开头,其中 d
是 0 到 9 之间的数字,这通常在您的日期类似于 2022-01-22
但是您的行以以下模式开头 dd/dd/dddd
,因此您需要更改多行模式以匹配行的开头。
此模式 ^[0-9]{2}\/[0-9]{2}\/[0-9]{4}
将匹配以日期开头的行,例如 18/11/2021
.
我找到问题所在了。我使用 filestream 作为 filebeat 输入。多行不适用于文件流。我已将类型更改为 log 然后一切正常。
filebeat.inputs:
multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}'
multiline.negate: true
multiline.match: after
- type: log
enabled: true
paths:
- .\My.log
output.logstash:
hosts: ["localhost:5044"]
我使用 filebeat 从 .txt 收集数据file.I正在尝试使用 Filebeat 多行功能,使用以下 Filebeat 配置将日志行合并为一个条目:
filebeat.inputs:
- type: filestream
enabled: true
multiline.pattern: '^[0-9]{2}\/[0-9]{2}\/[0-9]{4}'
multiline.negate: true
multiline.match: after
paths:
- .\My.log
output.logstash:
hosts: ["localhost:5044"]
这是一个日志示例。我想合并堆栈跟踪日志。
18/11/2021 19:17:25,717 [96] ERROR B2XPPA.Web.UI.Utilities.GlobalExceptionFilter -
System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at B2X.AddressRestfulAPIClient.RestfulWebAPIClient.GetDetails(String url)
at B2X.AddressValidation.AddressValidation.GetEircodeAddress(String Eircodeid)
at B2XPPA.Web.UI.Services.DropdownsPPAService.GetEircodeAddress(String eirCodeId)
at B2XPPA.Web.UI.Models.Populators.PPADetailsPopulator.Populate(IViewModel viewModel, Quote quote)
at B2X.Services.ApplicationService.Application`1.PopulateDetailsView(DetailsViewModel viewModel, String referenceNumberInController, Quote quote)
at B2XPPA.Web.UI.Controllers.QuoteController.Create(QuoteDetailsViewModel viewModel)
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
但是,Kibana 中的所有日志继续在每个新行处分开,并且根本没有发生多行格式化。谁能帮我解决这个问题?
您的多行模式与任何内容都不匹配。
模式 ^[0-9]{4}-[0-9]{2}-[0-9]{2}
期望您的行以 dddd-dd-dd
开头,其中 d
是 0 到 9 之间的数字,这通常在您的日期类似于 2022-01-22
但是您的行以以下模式开头 dd/dd/dddd
,因此您需要更改多行模式以匹配行的开头。
此模式 ^[0-9]{2}\/[0-9]{2}\/[0-9]{4}
将匹配以日期开头的行,例如 18/11/2021
.
我找到问题所在了。我使用 filestream 作为 filebeat 输入。多行不适用于文件流。我已将类型更改为 log 然后一切正常。
filebeat.inputs:
multiline.pattern: '^[0-9]{4}-[0-9]{2}-[0-9]{2}'
multiline.negate: true
multiline.match: after
- type: log
enabled: true
paths:
- .\My.log
output.logstash:
hosts: ["localhost:5044"]