CN111913922B - Binary structured log generation method, device, equipment and storage medium - Google Patents
Binary structured log generation method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN111913922B CN111913922B CN201910388560.1A CN201910388560A CN111913922B CN 111913922 B CN111913922 B CN 111913922B CN 201910388560 A CN201910388560 A CN 201910388560A CN 111913922 B CN111913922 B CN 111913922B
- Authority
- CN
- China
- Prior art keywords
- log
- standard
- structured
- application request
- standard structure
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/1805—Append-only file systems, e.g. using logs or journals to store data
- G06F16/1815—Journaling file systems
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明实施例公开了二进制结构化日志的生成方法、装置、设备和存储介质,该方法包括:获取与用户行为匹配的应用请求,所述应用请求包括:键值对形式的行为数据;根据与所述应用请求匹配的标准结构体模型,对所述应用请求中的所述键值对形式的行为数据进行处理,得到与所述应用请求匹配的结构化日志;将所述结构化日志处理为二进制结构化日志,并写入至文件。本发明实施例的技术方案,利用标准结构体模型处理应用请求中的行为数据,进而生成结构化日志,未产生任何中间文件,节省了存储资源,也避免了复杂的日志解析过程,同时,通过序列化操作获取到二进制结构化日志,极大地减少了日志体积,便于日志的传输,降低了数据传输过程中的资源消耗。
Embodiments of the present invention disclose methods, devices, equipment and storage media for generating binary structured logs. The method includes: obtaining an application request that matches user behavior, where the application request includes: behavior data in the form of key-value pairs; The standard structure model matching the application request processes the behavioral data in the form of key-value pairs in the application request to obtain a structured log that matches the application request; processes the structured log as Binary structured log and written to file. The technical solution of the embodiment of the present invention uses a standard structure model to process behavioral data in application requests and then generates structured logs without generating any intermediate files, saving storage resources and avoiding complex log parsing processes. At the same time, through The serialization operation obtains binary structured logs, which greatly reduces the log volume, facilitates log transmission, and reduces resource consumption during data transmission.
Description
技术领域Technical field
本发明实施例涉及互联网领域,尤其涉及二进制结构化日志的生成方法、装置、设备及存储介质。Embodiments of the present invention relate to the field of the Internet, and in particular to methods, devices, equipment and storage media for generating binary structured logs.
背景技术Background technique
随着互联网技术的不断发展,互联网的应用人群及业务类型都在不断增长,各种业务的运行使得互联网每天产生大量的日志,而这些日志是互联网大数据分析的重要组成部分,因此,具有极高的挖掘及分析价值。With the continuous development of Internet technology, the number of Internet application groups and business types are constantly growing. The operation of various businesses causes the Internet to generate a large number of logs every day, and these logs are an important part of Internet big data analysis. Therefore, they are extremely important. High mining and analysis value.
处理这些数量庞大的日志,首先需要进行日志解析,即抽取有意义的字段,把非结构化的数据转变为结构化的数据。通常是将所有日志打印成文本文件,然后通过编写日志分析程序对文本文件进行解析。To process these huge amounts of logs, you first need to perform log parsing, that is, extract meaningful fields and transform unstructured data into structured data. Usually all logs are printed into text files, and then the text files are parsed by writing a log analysis program.
然而,不同格式的日志需要编写不同类型的日志解析程序,日志格式的变更需要下游的解析程序也随之变化,因此解析成本较大,同时解析过程复杂,容易出错;另外,由于日志数据量过大,在存储和传输过程中,需要消耗大量资源,因此,存储和传输成本极高。However, different types of log parsing programs need to be written for different formats of logs. Changes in the log format require downstream parsing programs to also change accordingly. Therefore, the parsing cost is high, and the parsing process is complex and error-prone. In addition, due to the excessive amount of log data, Large, a large amount of resources are consumed during storage and transmission, so storage and transmission costs are extremely high.
发明内容Contents of the invention
本发明实施例提供了二进制结构化日志的生成方法、装置、计算机设备及存储介质。以实现根据用户应用请求直接生成结构化日志,避免了复杂的日志解析过程,节省了日志数据在存储和传输过程中的资源消耗。Embodiments of the present invention provide methods, devices, computer equipment and storage media for generating binary structured logs. In order to directly generate structured logs according to user application requests, it avoids the complex log parsing process and saves resource consumption in the storage and transmission process of log data.
第一方面,本发明实施例提供了二进制结构化日志的生成方法,包括:In the first aspect, embodiments of the present invention provide a method for generating binary structured logs, including:
获取与用户行为匹配的应用请求,所述应用请求包括:键值对形式的行为数据;Obtain an application request that matches the user's behavior, where the application request includes: behavior data in the form of key-value pairs;
根据与所述应用请求匹配的标准结构体模型,对所述应用请求中的所述键值对形式的行为数据进行处理,得到与所述应用请求匹配的结构化日志;其中,所述标准结构体模型包括:至少一个标准字段名,以及与所述标准字段名匹配的待填充区域;According to the standard structure model that matches the application request, the behavioral data in the form of key-value pairs in the application request is processed to obtain a structured log that matches the application request; wherein, the standard structure The volume model includes: at least one standard field name, and an area to be filled that matches the standard field name;
将所述结构化日志处理为二进制结构化日志,并写入至文件,生成二进制结构化文件。The structured log is processed into a binary structured log and written to a file to generate a binary structured file.
第二方面,本发明实施例提供了二进制结构化日志的生成装置,包括:In the second aspect, embodiments of the present invention provide a device for generating binary structured logs, including:
应用请求获取模块,用于获取与用户行为匹配的应用请求,所述应用请求包括:键值对形式的行为数据;The application request acquisition module is used to obtain application requests that match user behavior, where the application requests include: behavior data in the form of key-value pairs;
结构化日志获取模块,用于根据与所述应用请求匹配的标准结构体模型,对所述应用请求中的所述键值对形式的行为数据进行处理,得到与所述应用请求匹配的结构化日志;其中,所述标准结构体模型包括:至少一个标准字段名,以及与所述标准字段名匹配的待填充区域;A structured log acquisition module, configured to process the behavioral data in the form of key-value pairs in the application request according to a standard structure model that matches the application request, and obtain a structured log that matches the application request. Log; wherein, the standard structure model includes: at least one standard field name, and an area to be filled that matches the standard field name;
二进制结构化日志获取模块,用于将所述结构化日志处理为二进制结构化日志,并写入至文件,生成二进制结构化文件。A binary structured log acquisition module is used to process the structured log into a binary structured log and write it to a file to generate a binary structured file.
第三方面,本发明实施例提供了一种计算机设备,所述计算机设备包括:一个或多个处理器;In a third aspect, embodiments of the present invention provide a computer device, which includes: one or more processors;
存储装置,用于存储一个或多个程序;A storage device for storing one or more programs;
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现本发明任意实施例所述的二进制结构化日志的生成方法。When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the binary structured log generation method described in any embodiment of the present invention.
第四方面,本发明实施例还提供了一种计算机存储介质,其上存储有计算机程序,该程序被处理器执行时实现如本发明任意实施例所述的二进制结构化日志的生成方法。In a fourth aspect, embodiments of the present invention also provide a computer storage medium on which a computer program is stored. When the program is executed by a processor, the method for generating a binary structured log as described in any embodiment of the present invention is implemented.
本发明实施例的技术方案,利用标准结构体模型处理应用请求中的行为数据,进而直接生成结构化日志,未产生任何中间文件,节省了存储资源,且避免了复杂的日志解析过程,节省了解析成本。同时,通过序列化操作获取到二进制结构化日志,既便于计算机读取,又减少了日志体积,便于日志传输,提高了数据传输效率,降低了数据传输过程中的资源消耗。The technical solution of the embodiment of the present invention uses a standard structure model to process behavioral data in application requests, and then directly generates structured logs without generating any intermediate files, saving storage resources, avoiding complex log parsing processes, and saving time. Analyze costs. At the same time, binary structured logs are obtained through serialization operations, which are easy for computers to read, reduce log volume, facilitate log transmission, improve data transmission efficiency, and reduce resource consumption during data transmission.
附图说明Description of the drawings
为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to explain the technical solutions of the embodiments of the present invention more clearly, the drawings required to be used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and therefore do not It should be regarded as a limitation of the scope. For those of ordinary skill in the art, other relevant drawings can be obtained based on these drawings without exerting creative efforts.
图1是本发明实施例一提供的二进制结构化日志的生成方法的流程图;Figure 1 is a flow chart of a binary structured log generation method provided by Embodiment 1 of the present invention;
图2是本发明实施例二提供的二进制结构化日志的生成方法的流程图;Figure 2 is a flow chart of a binary structured log generation method provided by Embodiment 2 of the present invention;
图3是本发明实施例三提供的二进制结构化日志的生成装置的结构框图;Figure 3 is a structural block diagram of a binary structured log generation device provided in Embodiment 3 of the present invention;
图4是本发明实施例四提供的计算机设备的结构框图。Figure 4 is a structural block diagram of a computer device provided by Embodiment 4 of the present invention.
具体实施方式Detailed ways
下面结合附图和实施例对本发明作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部结构。The present invention will be further described in detail below in conjunction with the accompanying drawings and examples. It can be understood that the specific embodiments described here are only used to explain the present invention, but not to limit the present invention. In addition, it should be noted that, for convenience of description, only some but not all structures related to the present invention are shown in the drawings.
另外还需要说明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部内容。在更加详细地讨论示例性实施例之前应当提到的是,一些示例性实施例被描述成作为流程图描绘的处理或方法。虽然流程图将各项操作(或步骤)描述成顺序的处理,但是其中的许多操作可以被并行地、并发地或者同时实施。此外,各项操作的顺序可以被重新安排。当其操作完成时所述处理可以被终止,但是还可以具有未包括在附图中的附加步骤。所述处理可以对应于方法、函数、规程、子例程、子程序等等。In addition, it should be noted that, for convenience of description, only part but not all of the content related to the present invention is shown in the drawings. Before discussing example embodiments in more detail, it should be mentioned that some example embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe various operations (or steps) as a sequential process, many of the operations may be performed in parallel, concurrently, or simultaneously. Additionally, the order of operations can be rearranged. The process may be terminated when its operation is completed, but may also have additional steps not included in the figures. The processing may correspond to a method, function, procedure, subroutine, subroutine, or the like.
实施例一Embodiment 1
图1为本发明实施例一提供的二进制结构化日志的生成方法的流程图,本实施例可适用于根据用户应用请求直接生成结构化日志,不产生中间文件的情况,该方法可以由本发明实施例中的二进制结构化日志的生成装置来执行,该装置可以采用软件和/或硬件的方式实现,并一般可以集成在服务器上。如图1所示,该方法具体包括如下操作:Figure 1 is a flow chart of a method for generating binary structured logs provided in Embodiment 1 of the present invention. This embodiment can be applied to situations where structured logs are directly generated according to user application requests without generating intermediate files. This method can be implemented by the present invention. The binary structured log generation device in the example is executed. This device can be implemented in software and/or hardware, and can generally be integrated on the server. As shown in Figure 1, this method specifically includes the following operations:
S110、获取与用户行为匹配的应用请求,所述应用请求包括:键值对形式的行为数据。S110. Obtain an application request that matches the user's behavior, where the application request includes: behavior data in the form of key-value pairs.
一般来说,客户端用户在使用应用程序(APP)时,会向服务器发送各种各样的应用请求,例如,路线搜索请求、导航请求或者购买请求等。上述应用请求一般会以HTTP请求的方式发送至服务器,该HTTP请求中包括了各种键值对形式的行为数据,因此上述HTTP请求一般会被服务器直接打印至文件,并将上述文件作为日志数据进行存储。Generally speaking, when a client user uses an application (APP), he or she will send various application requests to the server, such as route search requests, navigation requests, or purchase requests. The above application request is generally sent to the server in the form of an HTTP request. The HTTP request includes behavioral data in the form of various key-value pairs. Therefore, the above HTTP request is generally printed directly to a file by the server and the above file is used as log data. for storage.
用户行为包括至少一个行为数据,涉及时间、地点、人物、交互以及交互内容等众多要素中的一个或多个;例如,用户搜索了某一件商品,那么该搜索行为的时间包括搜索发生的时间和/或页面停留时间;地点包括用户所在的地理位置、网络地址和/或页面中的点击位置;人物包括用户的个人信息,例如,搜索时登录或注册的账户信息,还包括所使用的终端设备、平台、渠道和/或网络信息,例如,搜索时使用的终端设备名称和/或IP地址;交互,即本次执行的操作类型为搜索;交互内容,即搜索内容以及搜索出的相关信息。User behavior includes at least one behavioral data, involving one or more of many elements such as time, place, person, interaction, and interactive content; for example, if the user searches for a certain item, then the time of the search behavior includes the time when the search occurs and/or the time spent on the page; the location includes the user's geographical location, network address and/or click location on the page; the person includes the user's personal information, such as the account information logged in or registered when searching, and the terminal used Device, platform, channel and/or network information, for example, the terminal device name and/or IP address used in the search; interaction, that is, the type of operation performed this time is search; interaction content, that is, the search content and related information searched out .
应用请求与用户行为是匹配的,例如,用户发出搜索请求,那么代表了用户的搜索行为;用户发出购买请求,则代表了用户的购买行为。应用请求可以通过点击功能按键触发,例如,点击“搜索”按键或者“购买”按键触发搜索请求或购买请求;还可以通过点击文字或图片触发,例如,点击文字或图片以查看详细内容触发用户的浏览请求;还可以通过终端设备的生物特征识别功能触发,例如,通过移动终端的指纹识别或面部识别触发付款请求;在本发明实施例中,可选的,对于应用请求的触发方式不作具体限定。应用请求可以由安装于智能终端的应用程序客户端发出,还可以由第三方浏览器访问的页面发出,在本发明实施例中,可选的,对应用请求的来源不作具体限定。Application requests match user behavior. For example, if a user issues a search request, it represents the user's search behavior; if a user issues a purchase request, it represents the user's purchasing behavior. Application requests can be triggered by clicking function buttons, for example, clicking the "Search" button or "Purchase" button to trigger a search request or purchase request; they can also be triggered by clicking text or pictures, for example, clicking text or pictures to view detailed content triggers the user's Browsing request; it can also be triggered by the biometric recognition function of the terminal device, for example, the payment request is triggered by fingerprint recognition or facial recognition of the mobile terminal; in the embodiment of the present invention, optionally, there is no specific limit on the triggering method of the application request. . The application request can be issued by an application client installed on the smart terminal, or by a page accessed by a third-party browser. In this embodiment of the present invention, optionally, the source of the application request is not specifically limited.
所述应用请求包括:键值对形式的行为数据。键值对是一种数据存储方式,包括了键名和键值,键名代表了行为数据的名称,键值代表了该行为数据赋予的值,即赋予的具体内容;例如,一个键值对为“金额=50元”,那么“金额”就是该行为数据的键名,“50元”则代表了该行为数据的值,即赋予的具体内容。The application request includes: behavioral data in the form of key-value pairs. Key-value pair is a data storage method, including key name and key value. The key name represents the name of the behavioral data, and the key value represents the value assigned to the behavioral data, that is, the specific content assigned; for example, a key-value pair is "Amount = 50 yuan", then "amount" is the key name of the behavior data, and "50 yuan" represents the value of the behavior data, that is, the specific content assigned.
S120、根据与所述应用请求匹配的标准结构体模型,对所述应用请求中的所述键值对形式的行为数据进行处理,得到与所述应用请求匹配的结构化日志;其中,所述标准结构体模型包括:至少一个标准字段名,以及与所述标准字段名匹配的待填充区域。S120. Process the behavioral data in the form of key-value pairs in the application request according to the standard structure model that matches the application request, and obtain a structured log that matches the application request; wherein, The standard structure model includes: at least one standard field name, and an area to be filled that matches the standard field name.
现有技术中,服务器将应用请求作为日志数据,利用文本日志生成工具,例如,log4j和glog等,打印生成文本日志,通过编写日志分析程序进行文本日志解析,再对该文本日志进行结构化处理,但是不同的文本日志需要编写不同的日志分析程序,因此,一旦日志源的日志格式变化,位于下游的解析程序也必须修改,解析成本极高。与现有技术相比,本实施例是利用标准结构体模型将用户的应用请求直接生成结构化日志,不需要经过将应用请求打印生成文件的步骤,未产生任何中间文件,而将该应用请求直接存储为结构化日志,节省了存储资源,同时避免了复杂的日志解析过程。In the existing technology, the server uses application requests as log data, uses text log generation tools, such as log4j and glog, etc., to print and generate text logs, parses the text logs by writing a log analysis program, and then performs structured processing on the text logs. , but different text logs require writing different log analysis programs. Therefore, once the log format of the log source changes, the downstream parsing program must also be modified, and the parsing cost is extremely high. Compared with the existing technology, this embodiment uses the standard structure model to directly generate a structured log from the user's application request. It does not need to go through the step of printing the application request to generate a file. No intermediate file is generated, and the application request is Direct storage as structured logs saves storage resources and avoids complex log parsing processes.
所述标准结构体模型是根据应用请求中包括的各种信息建立的,不同的应用请求对应不同的标准结构体模型。标准结构体模型可以由工作人员手动建立,例如,对于用户的购买请求,其中包括了用户的姓名、联系方式、商品名称、下单时间和地址等多个信息,因此可以预先建立包括上述信息在内的标准结构体模型用以处理购买请求;还可以根据应用请求自动创建标准结构体模型,例如,当获取到的应用请求未找到对应的标准结构体模型时,根据所述应用请求创建标准结构体模型,并将所述应用请求包括的键值对的键名作为标准结构体模型的标准字段名,为各标准字段名设置待填充区域。在本发明实施例中,可选的,对于标准结构体模型的建立方式不作具体限定。The standard structure model is established based on various information included in the application request, and different application requests correspond to different standard structure models. The standard structure model can be built manually by staff. For example, for a user's purchase request, it includes multiple information such as the user's name, contact information, product name, order time and address, so it can be pre-established including the above information. The standard structure model in the application is used to process purchase requests; the standard structure model can also be automatically created according to the application request. For example, when the obtained application request does not find the corresponding standard structure model, a standard structure model is created according to the application request. structure model, and use the key name of the key-value pair included in the application request as the standard field name of the standard structure model, and set an area to be filled for each standard field name. In the embodiment of the present invention, optionally, there is no specific limitation on the way to establish the standard structure model.
所述标准结构体模型包括至少一个标准字段名,以及与标准字段名匹配的待填充区域。可选的,在本发明实施例中,在所述标准结构体模型中依次获取一个标准字段名作为目标字段名;如果所述行为数据中存在与所述目标字段名匹配的目标键名,则将与所述目标键名对应的键值填充于所述标准结构体模型中与所述目标字段名对应的待填充区域内;返回执行在所述标准结构体模型中依次获取一个标准字段名作为目标字段名的操作,直至完成对所述标准结构体模型中全部标准字段名的处理。如果所述行为数据中不存在与所述目标字段名匹配的目标字段值,则放弃对标准结构体模型中与所述目标字段名对应的待填充区域进行填充处理。The standard structure model includes at least one standard field name and an area to be filled that matches the standard field name. Optionally, in this embodiment of the present invention, a standard field name is sequentially obtained in the standard structure model as the target field name; if there is a target key name matching the target field name in the behavioral data, then Fill the key value corresponding to the target key name in the area to be filled corresponding to the target field name in the standard structure model; return to the execution to obtain a standard field name in the standard structure model as The target field name is operated until all standard field names in the standard structure model are processed. If there is no target field value matching the target field name in the behavioral data, the filling process of the area to be filled corresponding to the target field name in the standard structure model is abandoned.
例如,标准结构体模型的标准字段名包括:“金额”、“时间”、“商品名称”和“账户类型”,以及与各标准字段名匹配的待填充区域;应用请求中键值对形式的行为数据包括:“金额=10元”、“时间=5点”、“订单编号=208A”、“商品名称=衣服”和“账户类型=会员”;标准结构体模型根据上述填充规则,依次获取金额”、“时间”、“商品名称”和“账户类型”作为目标字段名,并根据应用请求中键值对形式的行为数据,将对应的键值填充于待填充区域,最终得到的结构化日志中包括:“金额=10元”、“时间=5点”、“商品名称=衣服”和“账户类型=会员”。For example, the standard field names of the standard structure model include: "Amount", "Time", "Product Name" and "Account Type", as well as the areas to be filled that match each standard field name; the application request in the form of key-value pairs Behavioral data includes: "amount = 10 yuan", "time = 5 o'clock", "order number = 208A", "product name = clothes" and "account type = member"; the standard structure model is obtained sequentially according to the above filling rules "Amount", "Time", "Product Name" and "Account Type" are used as target field names, and based on the behavioral data in the form of key-value pairs in the application request, the corresponding key values are filled in the area to be filled, and the final structured The log includes: "amount = 10 yuan", "time = 5 o'clock", "product name = clothes" and "account type = member".
可选的,在本发明实施例中,可以采用set函数将与所述目标键名对应的键值填充于所述标准结构体模型中与所述目标字段名对应的待填充区域内。set函数是一种关联式容器,用来存储同一数据类型的数据,并且能从同一个数据集合中取出数据。特别的,set函数中每个成员的值都是唯一的,且该值不能被修改。Optionally, in this embodiment of the present invention, a set function can be used to fill the key value corresponding to the target key name in the area to be filled corresponding to the target field name in the standard structure model. The set function is an associative container that is used to store data of the same data type and can retrieve data from the same data collection. In particular, the value of each member in the set function is unique and cannot be modified.
S130、将所述结构化日志处理为二进制结构化日志,并写入至文件,生成二进制结构化文件。S130. Process the structured log into a binary structured log and write it into a file to generate a binary structured file.
在本发明实施例中,可选的,利用序列化处理工具,将所述结构化日志处理为二进制结构化日志,所述序列化处理工具包括Protobuf。序列化(Serialization)是将目标对象的状态信息转换为可存储形态和/或可传输形态的过程,以便于数据的存储和/或传输,在本发明实施例中,该形态为二进制格式。Protobuf是一种用于对结构化数据进行序列化的协议,具有灵活且高效的特点,经过Protobuf序列化后的代码流较小,速度较快,适合执行大批量的序列化操作。In this embodiment of the present invention, optionally, a serialization processing tool is used to process the structured log into a binary structured log. The serialization processing tool includes Protobuf. Serialization is a process of converting the state information of a target object into a storable and/or transmissible form to facilitate data storage and/or transmission. In this embodiment of the present invention, this form is a binary format. Protobuf is a protocol used to serialize structured data. It is flexible and efficient. The code flow after Protobuf serialization is smaller and faster, making it suitable for performing large-volume serialization operations.
由于二进制的数制在计算机中的广泛应用,因此,将结构化日志处理为二进制结构化日志,不但便于计算机读取,而且减少了日志的体积,降低了传输过程中的资源消耗,提升了后续进行大数据处理时的效率。Since the binary number system is widely used in computers, processing structured logs into binary structured logs is not only easier for computers to read, but also reduces the size of the log, reduces resource consumption during the transmission process, and improves subsequent Efficiency in big data processing.
进一步的,在生成该二进制结构化文件后,可以将该二进制结构化文件进行本地存储,或者可以发送至专门的日志存储平台进行日志存储。Further, after the binary structured file is generated, the binary structured file can be stored locally or sent to a specialized log storage platform for log storage.
在本发明实施例中,如果该二进制结构化文件存储于本地,还可以相应向有日志查看需求的用户开放查看权限,在用户查看某一日志之前,需要将该二进制结构化日志转换为便于用户阅读的数据格式。In the embodiment of the present invention, if the binary structured file is stored locally, viewing permissions can also be opened to users who have log viewing needs. Before the user views a certain log, the binary structured log needs to be converted into a format that is convenient for the user. Reading data format.
可选的,在将所述结构化日志处理为二进制结构化日志,并写入至文件之后,若检测到针对所述二进制结构化日志的查看请求时,采用反序列化处理工具,将所述二进制结构化日志重新处理为所述结构化日志并进行显示。反序列化(Deserialization)是将二进制格式等可存储或可传输形态转化为对象的过程,在本发明实施例中,即转化为结构化日志的过程,用以显示对象的实际形态。Optionally, after processing the structured log into a binary structured log and writing it to a file, if a viewing request for the binary structured log is detected, use a deserialization processing tool to convert the The binary structured log is reprocessed into the structured log and displayed. Deserialization is a process of converting a storable or transmissible form such as a binary format into an object. In the embodiment of the present invention, it is a process of converting the object into a structured log to display the actual form of the object.
本发明实施例的技术方案,利用标准结构体模型处理应用请求中的行为数据,进而直接生成结构化日志,未产生任何中间文件,节省了存储资源,且避免了复杂的日志解析过程,节省了解析成本。同时,通过序列化操作获取到二进制结构化日志,既便于计算机读取,又减少了日志体积,便于日志传输,提高了数据传输效率,降低了数据传输过程中的资源消耗。The technical solution of the embodiment of the present invention uses a standard structure model to process behavioral data in application requests, and then directly generates structured logs without generating any intermediate files, saving storage resources, avoiding complex log parsing processes, and saving time. Analyze costs. At the same time, binary structured logs are obtained through serialization operations, which are easy for computers to read, reduce log volume, facilitate log transmission, improve data transmission efficiency, and reduce resource consumption during data transmission.
实施例二Embodiment 2
图2为本发明实施例二提供的二进制结构化日志的生成方法的流程图,本实施例以上述实施例为基础进行具体化,在本实施例中,应用请求还包括:请求类型。相应的,本实施例的方法具体包括如下操作:Figure 2 is a flow chart of a method for generating binary structured logs provided in Embodiment 2 of the present invention. This embodiment is embodied based on the above embodiment. In this embodiment, the application request also includes: a request type. Correspondingly, the method of this embodiment specifically includes the following operations:
S210、获取与用户行为匹配的应用请求,所述应用请求包括:键值对形式的行为数据和请求类型。S210. Obtain an application request that matches the user's behavior, where the application request includes: behavior data and request type in the form of key-value pairs.
应用请求按照功能不同分成不同的请求类型,多个应用请求可以对应一个请求类型。例如,分别点击不同的文字或图片以查看详细内容,其应用请求不同,但其请求类型相同,均为浏览请求。Application requests are divided into different request types according to different functions. Multiple application requests can correspond to one request type. For example, if you click on different texts or pictures to view detailed content, the application requests are different, but the request types are the same, and they are all browsing requests.
S220、获取与所述请求类型匹配的日志类型,并根据所述日志类型,在多个备选的标准结构体模型中,获取与所述应用请求匹配的标准结构体模型。S220: Obtain a log type that matches the request type, and obtain a standard structure model that matches the application request among multiple alternative standard structure models according to the log type.
一个请求类型对应一种日志类型,例如,上述浏览请求对应浏览日志。而一个日志类型则对应多个备选的标准结构体模型,在备选的多个标准结构体模型中获取与应用请求匹配的标准结构体模型。例如,与上述浏览日志对应的标准结构体模型中,包括用于处理图片浏览请求的标准结构体模型,还包括用于处理文字浏览请求的标准结构体模型,根据具体的应用请求获取对应的标准结构体模型。One request type corresponds to one log type. For example, the above browsing request corresponds to the browsing log. One log type corresponds to multiple alternative standard structure models, and the standard structure model matching the application request is obtained from the multiple alternative standard structure models. For example, the standard structure model corresponding to the above browsing log includes a standard structure model for processing image browsing requests and a standard structure model for processing text browsing requests. The corresponding standards are obtained according to specific application requests. Structural model.
S230、根据与所述应用请求匹配的标准结构体模型,对所述应用请求中的所述键值对形式的行为数据进行处理,得到与所述应用请求匹配的结构化日志;其中,所述标准结构体模型包括:至少一个标准字段名,以及与所述标准字段名匹配的待填充区域。S230. Process the behavioral data in the form of key-value pairs in the application request according to the standard structure model that matches the application request, and obtain a structured log that matches the application request; wherein, The standard structure model includes: at least one standard field name, and an area to be filled that matches the standard field name.
S240、将所述结构化日志处理为二进制结构化日志,并写入至文件,生成二进制结构化文件。S240. Process the structured log into a binary structured log and write it into a file to generate a binary structured file.
可选的,本发明实施例中的二进制结构化日志的生成方法,还包括:接收至少一个日志数据生成平台上传的至少一类标准结构体模型,并生成与所述标准结构体模型匹配的模型视图;所述标准结构体模型与日志类型关联;将所述模型视图发布给与日志数据生成平台匹配的至少一个日志数据使用平台,以使所述日志数据使用平台利用所述模型视图查看与所述标准结构体模型对应的二进制结构化文件。Optionally, the method for generating binary structured logs in the embodiment of the present invention also includes: receiving at least one type of standard structure model uploaded by at least one log data generation platform, and generating a model that matches the standard structure model. View; the standard structure model is associated with the log type; publishing the model view to at least one log data usage platform that matches the log data generation platform, so that the log data usage platform uses the model view to view the data related to the log data generation platform. The binary structured file corresponding to the above-mentioned standard structure model.
从日志数据生成平台获取标准结构体模型,由于标准结构体模型与日志类型关联,因此,由标准结构体模型生成的模型视图可以反映出对应的日志类型的结构;所述模型视图可以是表(table)、列(column)或视图(view)等格式。而产生日志数据的平台与使用这些日志数据的平台往往是不同的平台,当日志数据使用平台收到匹配的日志数据生成平台发布的模型视图后,可以使用这些模型视图查看日志数据生成平台生成的二进制结构化文件。Obtain the standard structure model from the log data generation platform. Since the standard structure model is associated with the log type, the model view generated by the standard structure model can reflect the structure of the corresponding log type; the model view can be a table ( table), column (column) or view (view) and other formats. The platform that generates log data and the platform that uses these log data are often different platforms. When the log data using platform receives the matching model views published by the log data generating platform, it can use these model views to view the log data generated by the log data generating platform. Binary structured file.
特别的,当工作人员在代码层面进行功能优化后,日志格式发生了变化,应用请求中键值对形式的行为数据发生变化,与其匹配的标准结构体模型以及生成的结构化日志和二进制结构化日志中也会产生相应变化,例如,导航请求发出后,原功能只提供了根据起始地点和到达地点生成的路线,但功能优化后,增加了拥堵状况的显示,此时,应用请求中增加了与拥堵状况相关的键值对形式的行为数据,与所述应用请求对应的标准结构体模型中也加入了对拥堵状况的统计,进而生成的结构化日志以及二进制结构化日志中均包括了与拥堵状况相关的记录。In particular, when staff optimized functions at the code level, the log format changed, the behavioral data in the form of key-value pairs in application requests changed, the matching standard structure model and the generated structured logs and binary structures Corresponding changes will also occur in the log. For example, after the navigation request is issued, the original function only provides routes generated based on the starting point and arrival point. However, after the function is optimized, the display of congestion conditions is added. At this time, the application request is added Behavioral data in the form of key-value pairs related to congestion conditions is included. Statistics on congestion conditions are also added to the standard structure model corresponding to the application request, and the generated structured logs and binary structured logs include Records related to congestion conditions.
日志数据使用平台使用功能优化后的模型视图查看功能优化前的二进制结构化文件时,依然可以正常获取,日志格式虽然发生了变更但是保证了向后兼容,即功能优化后版本的模型视图可以打开功能优化前版本的二进制结构化文件;但是由于该二进制结构化文件是功能优化之前生成的,其中不包括功能优化之后的相关记录,因此功能优化后的模型视图打开该二进制结构化文件时不会显示该记录,例如,上述与拥堵状况相关的记录,在功能优化之前生成的二进制结构化文件中是不包括此记录的,因此,使用功能优化后的模型视图打开功能优化前的二进制结构化文件不会显示与拥堵状况相关的记录。When the log data usage platform uses the model view after function optimization to view the binary structured file before function optimization, it can still be obtained normally. Although the log format has changed, backward compatibility is guaranteed, that is, the model view of the function optimization version can be opened. The binary structured file of the version before function optimization; however, because the binary structured file was generated before function optimization, it does not include related records after function optimization, so the model view after function optimization will not open the binary structured file. Display this record, for example, the above-mentioned record related to congestion conditions. This record is not included in the binary structured file generated before function optimization. Therefore, use the model view after function optimization to open the binary structured file before function optimization. Records related to congestion conditions will not be displayed.
日志数据使用平台使用功能优化前的模型视图查看功能优化后的二进制结构化文件时,同样可以正常获取,日志格式虽然发生了变更但是保证了向前兼容,即功能优化前版本的模型视图可以打开功能优化后版本的二进制结构化文件;但是由于该模型视图是功能优化之前生成的,其中不包括功能优化之后的相关记录,因此功能优化前的模型视图打开该二进制结构化文件不会显示该相关记录,例如,上述与拥堵状况相关的记录,在功能优化之前生成的模型视图中是不包括此记录的,因此,使用功能优化前的模型视图打开功能优化后的二进制结构化文件不会显示与拥堵状况相关的记录。When the log data usage platform uses the model view before function optimization to view the binary structured file after function optimization, it can also be obtained normally. Although the log format has changed, forward compatibility is guaranteed, that is, the model view of the version before function optimization can be opened. The binary structured file of the function-optimized version; however, since the model view was generated before function optimization, it does not include related records after function optimization, so opening the binary structured file in the model view before function optimization will not display the related records. Records, for example, the above-mentioned records related to congestion conditions, are not included in the model view generated before function optimization. Therefore, using the model view before function optimization to open the binary structured file after function optimization will not display the same Records related to congestion conditions.
本发明实施例的技术方案,根据应用请求的请求类型获取匹配的日志类型,再从与日志类型匹配的多个标准结构体模型中获取到目标标准结构体模型,使得每一个应用请求只需要在与其请求类型匹配的一个日志类型中寻找需要的标准结构体模型即可,而不需要在所有的标准结构体模型中寻找目标标准结构体模型,提高了获取效率,进而提高了各应用请求转化为结构化日志的转化速度。同时,使用模型视图管理日志格式,实现了日志格式的向前兼容和向后兼容,保证了功能优化前后的日志均可以正常使用,避免了数据丢失。The technical solution of the embodiment of the present invention obtains a matching log type according to the request type of the application request, and then obtains the target standard structure model from multiple standard structure models matching the log type, so that each application request only needs to Just search for the required standard structure model in a log type that matches its request type, instead of searching for the target standard structure model in all standard structure models, which improves the acquisition efficiency and thus improves the conversion of each application request into Structured log conversion speed. At the same time, the model view is used to manage the log format, achieving forward and backward compatibility of the log format, ensuring that the logs before and after function optimization can be used normally, and avoiding data loss.
实施例三Embodiment 3
图3为本发明实施例三提供的二进制结构化日志的生成装置的结构框图,该装置包括:应用请求获取模块310、结构化日志获取模块320和二进制结构化日志获取模块330。Figure 3 is a structural block diagram of a binary structured log generation device provided in Embodiment 3 of the present invention. The device includes: an application request acquisition module 310, a structured log acquisition module 320 and a binary structured log acquisition module 330.
应用请求获取模块310,用于获取与用户行为匹配的应用请求,所述应用请求包括:键值对形式的行为数据;The application request acquisition module 310 is used to obtain application requests that match user behavior, where the application requests include: behavior data in the form of key-value pairs;
结构化日志获取模块320,用于根据与所述应用请求匹配的标准结构体模型,对所述应用请求中的所述键值对形式的行为数据进行处理,得到与所述应用请求匹配的结构化日志;其中,所述标准结构体模型包括:至少一个标准字段名,以及与所述标准字段名匹配的待填充区域;The structured log acquisition module 320 is configured to process the behavioral data in the form of key-value pairs in the application request according to the standard structure model that matches the application request, and obtain a structure that matches the application request. Log; wherein, the standard structure model includes: at least one standard field name, and an area to be filled that matches the standard field name;
二进制结构化日志获取模块330,用于将所述结构化日志处理为二进制结构化日志,并写入至文件,生成二进制结构化文件。The binary structured log acquisition module 330 is used to process the structured log into a binary structured log, write it into a file, and generate a binary structured file.
本发明实施例的技术方案,利用标准结构体模型处理应用请求中的行为数据,进而直接生成结构化日志,未产生任何中间文件,节省了存储资源,且避免了复杂的日志解析过程,节省了解析成本。同时,通过序列化操作获取到二进制结构化日志,既便于计算机读取,又减少了日志体积,便于日志传输,提高了数据传输效率,降低了数据传输过程中的资源消耗。The technical solution of the embodiment of the present invention uses a standard structure model to process behavioral data in application requests, and then directly generates structured logs without generating any intermediate files, saving storage resources, avoiding complex log parsing processes, and saving time. Analyze costs. At the same time, binary structured logs are obtained through serialization operations, which are easy for computers to read, reduce log volume, facilitate log transmission, improve data transmission efficiency, and reduce resource consumption during data transmission.
可选的,在上述技术方案的基础上,结构化日志获取模块320,具体可以包括:Optionally, based on the above technical solution, the structured log acquisition module 320 may specifically include:
目标字段名获取单元,用于在所述标准结构体模型中依次获取一个标准字段名作为目标字段名;The target field name acquisition unit is used to sequentially acquire a standard field name as the target field name in the standard structure model;
键值填充单元,用于如果所述行为数据中存在与所述目标字段名匹配的目标键名,则将与所述目标键名对应的键值填充于所述标准结构体模型中与所述目标字段名对应的待填充区域内;A key value filling unit, configured to fill the key value corresponding to the target key name in the standard structure model and the Within the area to be filled corresponding to the target field name;
返回单元,用于返回执行在所述标准结构体模型中依次获取一个标准字段名作为目标字段名的操作,直至完成对所述标准结构体模型中全部标准字段名的处理。The return unit is used to return and execute the operation of sequentially obtaining a standard field name as a target field name in the standard structure model until the processing of all standard field names in the standard structure model is completed.
可选的,在上述技术方案的基础上,结构化日志获取模块320,还可以包括:Optionally, based on the above technical solution, the structured log acquisition module 320 may also include:
填充放弃单元,用于如果所述行为数据中不存在与所述目标字段名匹配的目标字段值,则放弃对标准结构体模型中与所述目标字段名对应的待填充区域进行填充处理。A filling abandonment unit is configured to, if there is no target field value matching the target field name in the behavior data, abandon the filling process of the area to be filled corresponding to the target field name in the standard structure model.
可选的,在上述技术方案的基础上,键值填充单元,具体用于:Optional, based on the above technical solution, the key value filling unit is specifically used for:
采用set函数,将与所述目标键名对应的键值填充于所述标准结构体模型中与所述目标字段名对应的待填充区域内。Using the set function, the key value corresponding to the target key name is filled in the area to be filled corresponding to the target field name in the standard structure model.
可选的,在上述技术方案的基础上,二进制结构化日志获取模块330,具体用于:Optionally, based on the above technical solution, the binary structured log acquisition module 330 is specifically used for:
利用序列化处理工具,将所述结构化日志处理为二进制结构化日志。Use a serialization processing tool to process the structured log into a binary structured log.
可选的,在上述技术方案的基础上,二进制结构化日志的生成装置,还可以包括:Optionally, based on the above technical solution, the device for generating binary structured logs may also include:
反序列化处理模块,用于在检测到针对所述二进制结构化日志的查看请求时,采用反序列化处理工具,将所述二进制结构化日志重新处理为所述结构化日志并进行显示。A deserialization processing module, configured to use a deserialization processing tool to reprocess the binary structured log into the structured log and display it when a viewing request for the binary structured log is detected.
可选的,在上述技术方案的基础上,应用请求,还可以包括:请求类型。Optionally, based on the above technical solution, the application request may also include: request type.
可选的,在上述技术方案的基础上,二进制结构化日志的生成装置,还可以包括:Optionally, based on the above technical solution, the device for generating binary structured logs may also include:
标准结构体模型获取模块,用于获取与所述请求类型匹配的日志类型,并根据所述日志类型,在多个备选的标准结构体模型中,获取与所述应用请求匹配的标准结构体模型。A standard structure model acquisition module is used to obtain a log type that matches the request type, and according to the log type, obtain a standard structure that matches the application request among multiple alternative standard structure models. Model.
可选的,在上述技术方案的基础上,二进制结构化日志的生成装置,还可以包括:Optionally, based on the above technical solution, the device for generating binary structured logs may also include:
模型视图生成模块,用于接收至少一个日志数据生成平台上传的至少一类标准结构体模型,并生成与所述标准结构体模型匹配的模型视图;所述标准结构体模型与日志类型关联;A model view generation module, configured to receive at least one type of standard structure model uploaded by at least one log data generation platform, and generate a model view that matches the standard structure model; the standard structure model is associated with the log type;
日志结构化类型获取模块,用于将所述模型视图发布给与日志数据生成平台匹配的至少一个日志数据使用平台,以使所述日志数据使用平台利用所述模型视图查看与所述标准结构体模型对应的二进制结构化文件。A log structured type acquisition module, configured to publish the model view to at least one log data usage platform that matches the log data generation platform, so that the log data usage platform uses the model view to view the standard structure The binary structured file corresponding to the model.
上述装置可执行本发明任意实施例所提供的二进制结构化日志的生成方法,具备执行方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本发明任意实施例提供的方法。The above-mentioned device can execute the binary structured log generation method provided by any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method. For technical details that are not described in detail in this embodiment, please refer to the method provided by any embodiment of the present invention.
实施例四Embodiment 4
图4为本发明实施例四提供的一种计算机设备的结构示意图。图4示出了适于用来实现本发明实施方式的示例性计算机设备12的框图。图4显示的计算机设备12仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。Figure 4 is a schematic structural diagram of a computer device provided in Embodiment 4 of the present invention. 4 illustrates a block diagram of an exemplary computer device 12 suitable for implementing embodiments of the present invention. The computer device 12 shown in FIG. 4 is only an example and should not bring any limitations to the functions and scope of use of the embodiments of the present invention.
如图4所示,计算机设备12以通用计算设备的形式表现。计算机设备12的组件可以包括但不限于:一个或者多个处理器或者处理单元16,系统存储器28,连接不同系统组件(包括系统存储器28和处理单元16)的总线18。As shown in Figure 4, computer device 12 is embodied in the form of a general purpose computing device. The components of computer device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and a bus 18 connecting various system components, including system memory 28 and processing unit 16.
总线18表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(ISA)总线,微通道体系结构(MAC)总线,增强型ISA总线、视频电子标准协会(VESA)局域总线以及外围组件互连(PCI)总线。Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics accelerated port, a processor, or a local bus using any of a variety of bus structures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect ( PCI) bus.
计算机设备12典型地包括多种计算机系统可读介质。这些介质可以是任何能够被计算机设备12访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。Computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer device 12, including volatile and nonvolatile media, removable and non-removable media.
系统存储器28可以包括易失性存储器形式的计算机系统可读介质,例如随机存取存储器(RAM)30和/或高速缓存存储器32。计算机设备12可以进一步包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。仅作为举例,存储系统34可以用于读写不可移动的、非易失性磁介质(图4未显示,通常称为“硬盘驱动器”)。尽管图4中未示出,可以提供用于对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非易失性光盘(例如CD-ROM,DVD-ROM或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过一个或者多个数据介质接口与总线18相连。存储器28可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本发明各实施例的功能。System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and/or cache memory 32 . Computer device 12 may further include other removable/non-removable, volatile/non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write to non-removable, non-volatile magnetic media (not shown in Figure 4, commonly referred to as a "hard drive"). Although not shown in FIG. 4, a disk drive may be provided for reading and writing removable non-volatile disks (e.g., "floppy disks"), and for removable non-volatile optical disks (e.g., CD-ROM, DVD-ROM). or other optical media) that can read and write optical disc drives. In these cases, each drive may be connected to bus 18 through one or more data media interfaces. Memory 28 may include at least one program product having a set (eg, at least one) of program modules configured to perform the functions of embodiments of the invention.
具有一组(至少一个)程序模块42的程序/实用工具40,可以存储在例如存储器28中,这样的程序模块42包括——但不限于——操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块42通常执行本发明所描述的实施例中的功能和/或方法。A program/utility 40 having a set of (at least one) program modules 42, which may be stored, for example, in the memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other programs Modules, as well as program data, each of these examples or some combination may include an implementation of a network environment. Program modules 42 generally perform functions and/or methods in the described embodiments of the invention.
计算机设备12也可以与一个或多个外部设备14(例如键盘、指向设备、显示器24等)通信,还可与一个或者多个使得用户能与该计算机设备12交互的设备通信,和/或与使得该计算机设备12能与一个或多个其它计算设备进行通信的任何设备(例如网卡,调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口22进行。并且,计算机设备12还可以通过网络适配器20与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器20通过总线18与计算机设备12的其它模块通信。应当明白,尽管图中未示出,可以结合计算机设备12使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。Computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with computer device 12, and/or with Any device (eg, network card, modem, etc.) that enables the computer device 12 to communicate with one or more other computing devices. This communication may occur through input/output (I/O) interface 22. Furthermore, computer device 12 may also communicate with one or more networks (eg, a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) through network adapter 20. As shown, network adapter 20 communicates with other modules of computer device 12 via bus 18 . It should be understood that, although not shown in the figures, other hardware and/or software modules may be used in conjunction with computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives And data backup storage system, etc.
处理单元16通过运行存储在系统存储器28中的程序,从而执行各种功能应用以及数据处理,例如实现本发明实施例所提供的二进制结构化日志的生成方法:获取与用户行为匹配的应用请求,所述应用请求包括:键值对形式的行为数据;根据与所述应用请求匹配的标准结构体模型,对所述应用请求中的所述键值对形式的行为数据进行处理,得到与所述应用请求匹配的结构化日志;其中,所述标准结构体模型包括:至少一个标准字段名,以及与所述标准字段名匹配的待填充区域;将所述结构化日志处理为二进制结构化日志,并写入至文件,生成二进制结构化文件。The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, for example, implementing the binary structured log generation method provided by the embodiment of the present invention: obtaining application requests that match user behavior, The application request includes: behavioral data in the form of key-value pairs; according to a standard structure model matching the application request, the behavioral data in the form of key-value pairs in the application request is processed to obtain the The application requests a matching structured log; wherein the standard structure model includes: at least one standard field name, and an area to be filled that matches the standard field name; the structured log is processed into a binary structured log, And write it to the file to generate a binary structured file.
实施例五Embodiment 5
本发明实施例五提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如本申请所有发明实施例提供的二进制结构化日志的生成方法:Embodiment 5 of the present invention provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for generating a binary structured log as provided by all the inventive embodiments of the present application is implemented:
获取与用户行为匹配的应用请求,所述应用请求包括:键值对形式的行为数据;Obtain an application request that matches the user's behavior, where the application request includes: behavior data in the form of key-value pairs;
根据与所述应用请求匹配的标准结构体模型,对所述应用请求中的所述键值对形式的行为数据进行处理,得到与所述应用请求匹配的结构化日志;其中,所述标准结构体模型包括:至少一个标准字段名,以及与所述标准字段名匹配的待填充区域;According to the standard structure model that matches the application request, the behavioral data in the form of key-value pairs in the application request is processed to obtain a structured log that matches the application request; wherein, the standard structure The volume model includes: at least one standard field name, and an area to be filled that matches the standard field name;
将所述结构化日志处理为二进制结构化日志,并写入至文件,生成二进制结构化文件。The structured log is processed into a binary structured log and written to a file to generate a binary structured file.
可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。Any combination of one or more computer-readable media may be employed. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any combination thereof. More specific examples (non-exhaustive list) of computer readable storage media include: electrical connections having one or more conductors, portable computer disks, hard drives, random access memory (RAM), read only memory (ROM), Erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. As used herein, a computer-readable storage medium may be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device.
计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括——但不限于——电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take a variety of forms, including - but not limited to - electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括——但不限于——无线、电线、光缆、RF等等,或者上述的任意合适的组合。Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
可以以一种或多种程序设计语言或其组合来编写用于执行本发明操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operations of the present invention may be written in one or more programming languages, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional Procedural programming language—such as "C" or a similar programming language. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In situations involving remote computers, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as an Internet service provider through Internet connection).
注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only the preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments. Without departing from the concept of the present invention, it can also include more other equivalent embodiments, and the present invention The scope is determined by the scope of the appended claims.
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910388560.1A CN111913922B (en) | 2019-05-10 | 2019-05-10 | Binary structured log generation method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910388560.1A CN111913922B (en) | 2019-05-10 | 2019-05-10 | Binary structured log generation method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111913922A CN111913922A (en) | 2020-11-10 |
CN111913922B true CN111913922B (en) | 2024-02-20 |
Family
ID=73242675
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910388560.1A Active CN111913922B (en) | 2019-05-10 | 2019-05-10 | Binary structured log generation method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111913922B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112559458B (en) * | 2020-12-11 | 2021-11-30 | 深圳金信诺高新技术股份有限公司 | Method and system for reducing log size |
CN113844505A (en) * | 2021-08-31 | 2021-12-28 | 通号城市轨道交通技术有限公司 | Train log processing method and device |
CN113742408B (en) * | 2021-09-03 | 2024-02-02 | 唯品会(广州)软件有限公司 | Data interaction method based on dynamic analysis of Protobuf protocol |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106371953A (en) * | 2015-07-22 | 2017-02-01 | 奥普塔姆软件股份有限公司 | Compact binary event log generation |
CN108038018A (en) * | 2017-12-22 | 2018-05-15 | 杭州闪捷信息科技有限公司 | Expansible daily record data storage method and device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9703675B2 (en) * | 2014-08-11 | 2017-07-11 | Microsoft Technology Licensing, Llc | Structured logging and instrumentation framework |
-
2019
- 2019-05-10 CN CN201910388560.1A patent/CN111913922B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106371953A (en) * | 2015-07-22 | 2017-02-01 | 奥普塔姆软件股份有限公司 | Compact binary event log generation |
CN108038018A (en) * | 2017-12-22 | 2018-05-15 | 杭州闪捷信息科技有限公司 | Expansible daily record data storage method and device |
Non-Patent Citations (2)
Title |
---|
Least squares adaptive algorithms suitable for multiplierless LMMSE detection in 3/sup rd/ generation mobile systems;C. Litchfield等;《IEEE Xplore》;全文 * |
基于Web Log的数据预处理研究;向坚持, 陈晓红, 刘相滨, 徐选华;湖南师范大学自然科学学报(04);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN111913922A (en) | 2020-11-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107832433B (en) | Dialogue interaction-based information recommendation method, device, server and storage medium | |
CN109002510B (en) | A dialogue processing method, apparatus, device and medium | |
CN111026931B (en) | Data query method, device, equipment and medium | |
JP2018533126A (en) | Method, system, and computer program product for a natural language interface to a database | |
CN112231407B (en) | DDL synchronization method, device, equipment and medium of PostgreSQL database | |
CN111913922B (en) | Binary structured log generation method, device, equipment and storage medium | |
CN111291882A (en) | A method, apparatus, device and computer storage medium for model conversion | |
CN109408834B (en) | Auxiliary machine translation method, device, equipment and storage medium | |
CN111324833A (en) | Page display method, apparatus, electronic design and computer readable medium | |
CN112015626A (en) | User behavior recording method, device and equipment | |
CN113792138B (en) | Report generation method and device, electronic equipment and storage medium | |
CN113760894B (en) | Data retrieval method, device, electronic device and storage medium | |
CN113962597A (en) | A data analysis method, device, electronic device and storage medium | |
CN114489622B (en) | Static resource management method, Node.js application, electronic device and storage medium | |
WO2022171093A1 (en) | Method and apparatus for constructing personnel relational graph, and electronic device | |
CN114676163A (en) | A data query method, device, equipment, system and storage medium | |
CN114428705A (en) | A method, device, device and storage medium for monitoring network data | |
CN118916361A (en) | Data query method, device, equipment, storage medium and program product | |
CN113448995A (en) | Database operation method, device and system, electronic equipment and storage medium | |
CN117271554A (en) | A distributed database view processing method, device, equipment and storage medium | |
CN111046430B (en) | Data processing method and device, storage medium and electronic equipment | |
CN114661289A (en) | Knowledge and data driving-based micro application development system and method | |
CN113687881A (en) | Metadata calling method and device, electronic equipment and storage medium | |
CN114564354A (en) | Database performance monitoring method, device, electronic device and storage medium | |
CN114416781A (en) | Data searching method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |