简体   繁体   English

从不同性质的日志文件中提取数据

[英]Extract data from Log Files of different nature

I am not looking for any code in specific but an idea or a head start. 我不是在寻找任何特定的代码,而是一个想法或一个开始。 I am trying to design an application with a User interface in which log files can be loaded. 我正在尝试设计一个带有用户界面的应用程序,可以在其中加载日志文件。

These log files are of different formats and types. 这些日志文件具有不同的格式和类型。 The data to be extracted also may vary with different files. 提取的数据也可能随文件的不同而不同。 I want to have one generic application to extract data from them. 我想要一个通用的应用程序来从中提取数据。 Thinking of Using some AI. 考虑使用一些AI。 Neural nets, Kalman, etc. 神经网络,卡尔曼(Kalman)等

Sample1 样本1

A, B, C, D, E
1, 2, 3, 4, 5
6, 7, 8, 9,10
 ,11,12,13,14

in the above example I want to extract only column D and A. And column D should be extracted only when column A value exists. 在上面的示例中,我只想提取D和A列。仅当A列存在值时才应提取D列。

Basically the log files are machine generated so there is no control on their formatting. 基本上,日志文件是计算机生成的,因此无法控制其格式。

I have thought of creating an application in which a log file can be loaded. 我已经考虑过创建一个可以在其中加载日志文件的应用程序。 The required areas highlighted and then based on that the other similar types of log files are processed. 突出显示所需区域,然后基于该区域处理其他类似类型的日志文件。

Any suggestions? 有什么建议么?

When it comes to doing "generic" things, your best bet is to use interfaces. 当涉及到“通用”事情时,最好的选择是使用接口。 You will also want to use a design principle like DDD. 您还将需要使用DDD之类的设计原理。 So, you want to create an ILogFile interface. 因此,您想创建一个ILogFile接口。 You will have different implementers of the ILogFile interface (an implementer class per log type, format or file). 您将具有ILogFile接口的不同实现者(每种日志类型,格式或文件的实现者类)。 You will have a service (an application or domain service) that can work on an ILogFile interface to extract data from it and apply rules to it. 您将拥有一个service (应用程序或域服务),该服务可以在ILogFile接口上工作以从中提取数据并对其应用规则。

Although you cant control the format, I am assuming the log file's format is predictable. 尽管您无法控制格式,但我假设日志文件的格式是可预测的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM