Log processing method, log and game server, system and electronic equipment
By starting the log thread on the game server to capture and transmit logs in real time to the separated log server, the problem of logging in the disk consumes storage resources and filebeat tools consumes CPU resources, achieving resource conservation and improving log processing efficiency.
Patent Information
- Application Number
- CN202411836508.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-08
AI Technical Summary
When using the ELK log system to process game server logs, the logs are dropped to the disk to consume storage resources, and the filebeat tool run consumes CPU resources, resulting in wasting game server resources.
Start the log thread on the game server, capture the game process log in real time and transmit it to the separated log server, avoiding logging and reducing CPU consumption.
By real-time transmission of logs and separating storage resources, the storage and CPU resources of the game server are saved and the log processing efficiency is improved.
Smart Images

Figure CN119770986A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular, to a log processing method, a log and a game server and system, and an electronic device. Background Art
[0002] The ELK (Elasticsearch, LogStash, Kibana) log system is widely used in Internet services. Elasticsearch is a distributed search and analysis engine that can store and retrieve large amounts of data, provide efficient full-text search capabilities, and support real-time data analysis. LogStash is a data processing pipeline that can collect data from multiple sources, filter and transform it, and then send it to the specified storage backend. Kibana is a data visualization tool that allows users to view and analyze data stored in Elasticsearch through a graphical interface.
[0003] In the related art, when using the ELK log system to process the logs generated by each game process in the game server, the logs generated by each game process in the game server are first written to the disk in the game server, and then transmitted to LogStash through the filebeat tool. Then LogStash sends the collected logs to Elasticsearch, which are processed by Elasticsearch and displayed to users through Kibana. This log processing method consumes more storage resources of the game server. Summary of the invention
[0004] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] In a first aspect, the present disclosure provides a log processing method, which is applied to a game server, the method comprising: starting a log thread, wherein the log thread is a thread for capturing logs generated by a game process in the game server; the log thread captures the logs generated by the game process to obtain a game process log; the log thread transmits the game process log to a log server in real time, wherein the storage resources of the log server are separated from the storage resources of the game server and are used to store the game process logs transmitted by the log thread as query logs, and the query logs can be used to implement queries on the logs generated by the game process.
[0006] In a second aspect, the present disclosure provides a log processing method, which is applied to a log server, the method comprising: receiving game process log information transmitted in real time by a log thread when a game process in the game server is running, wherein the log thread is a thread on the game server that captures logs generated by the game process, the game process log information includes a game process log, and the game process log is a log generated by the game process, and the storage resources of the log server are separated from the storage resources of the game server; storing the received game process log in the storage resources of the log server to obtain a query log; and querying the log generated by the game process based on the query log.
[0007] In a third aspect, the present disclosure provides a game server, comprising a startup module and a log process, wherein: the startup module is used to start the log thread, wherein the log thread is a thread for capturing logs generated by a game process in the game server; the log thread is used to capture the logs generated by the game process, obtain the game process logs, and transmit the game process logs to the log server in real time, wherein the storage resources of the log server are separated from the storage resources of the game server and are used to store the game process logs transmitted by the log thread as query logs, and the query logs can be used to implement queries on the logs generated by the game process.
[0008] In a fourth aspect, the present disclosure provides a log server, comprising: a receiving module, used to receive game process log information transmitted in real time by a log thread when a game process in the game server is running, wherein the log thread is a thread on the game server that captures logs generated by the game process, the game process log information includes a game process log, and the game process log is a log generated by the game process, and the storage resources of the log server are separated from the storage resources of the game server; a storage module, used to store the received game process log in the storage resources of the log server to obtain a query log; and a query module, used to query the log generated by the game process based on the query log.
[0009] In a fifth aspect, the present disclosure provides a log system, comprising: a game server, used to execute the log processing method according to any one of the first aspects; and a log server, used to execute the log processing method according to any one of the second aspects.
[0010] In a sixth aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in any one of the first aspect or the second aspect.
[0011] In a seventh aspect, the present disclosure provides an electronic device, comprising: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of the method described in any one of the first aspect or the second aspect.
[0012] In an eighth aspect, the present disclosure provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method described in any one of the first aspect or the second aspect.
[0013] By adopting the above technical solution, the log thread can be started, and the log generated by the game process in the game server is captured by the log thread to obtain the game process log and transmit the game process log to the log server in real time, and the storage resources of the log server are separated from the storage resources of the game server and used to store the game process log transmitted by the log thread. Therefore, by real-time transmission and the separation of the log server storage resources and the game server storage resources, the game process log will not consume the storage resources of the game server, which greatly saves the storage resources of the game server. Moreover, it is not necessary to transfer the log on the game server to the machine where the ELK log system is located by the filebeat tool as in the related art, which greatly saves the CPU resources of the game server.
[0014] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings:
[0016] Figure 1 This is a schematic diagram of the game server structure.
[0017] Figure 2 This is the log processing architecture diagram of the general ELK log system for game servers.
[0018] Figure 3 is an architectural diagram of a log system according to an embodiment of the present disclosure.
[0019] Figure 4 The present invention is a flowchart of a log processing method according to an embodiment of the present invention.
[0020] Figure 5 4 is a schematic diagram of a state machine of a log thread according to an embodiment of the present disclosure.
[0021] Figure 6It is a schematic diagram of a transmission message structure used by a log thread to transmit a game process log to a log server according to an embodiment of the present disclosure.
[0022] Figure 7 The present invention is a flowchart of a log processing method according to an embodiment of the present invention.
[0023] Figure 8 It is a schematic diagram of a transmission message structure used by a log server to transmit a confirmation message to a log thread according to an embodiment of the present disclosure.
[0024] Fig. 9 A schematic diagram of the structure of a log meta information file according to an embodiment of the present disclosure is shown.
[0025] Fig.10 It is a schematic diagram of executing a session in a coroutine manner according to an embodiment of the present disclosure.
[0026] Fig.11 is a schematic block diagram of a game server according to an embodiment of the present disclosure.
[0027] Fig.12 It is a schematic block diagram of a log server according to an embodiment of the present disclosure.
[0028] Fig.13 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0029] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0030] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0031] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0032] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0033] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0034] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0035] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0036] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0037] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0038] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0039] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0040] Game servers are usually deployed in the form of game zones. Each game zone consists of several game servers, each game server consists of several game processes, and each game process generates logs. Figure 1 This is a schematic diagram of the game server structure.
[0041] For the entire game server, the common ELK log system is as follows Figure 2 As shown. First, the logs generated by the game process are written to the disk on the game server where the game process is located, and then the filebeat tool is used to transfer the logs that have been written to the disk on the game server to the machine where the ELK log system is located. The disadvantage of this log processing method is that the logs generated by the game process will consume the storage resources of the game server when written to the disk on the game server, and the filebeat tool will consume a large amount of the central processing unit (CPU) resources of the game server when it is running.
[0042] Therefore, the general ELK log system is not applicable to game servers deployed in the form of game zones.
[0043] Before describing in detail the log processing method according to the embodiment of the present disclosure, the log system according to the embodiment of the present disclosure is first introduced. Figure 3 1 is an architecture diagram of a log system according to an embodiment of the present disclosure. The log system can process logs generated by a game process on a game server, for example, it can be applicable to a game server deployed in the form of a game zone server.
[0044] like Figure 3 As shown, the log system 100 according to the embodiment of the present disclosure includes a game server 101 and a log server 102 .
[0045] A log thread is started on the game server 101, wherein the log thread is a thread for capturing logs generated by the game process in the game server. The log thread can be set as a part of the game process, and when the game process is running, the log thread is also started to capture the logs generated by the game process in real time and transmit the captured logs to the log server 102 in real time.
[0046] The relationship between the log thread and the game process can be one-to-one. That is, one log thread is used to capture and transmit the logs generated by a game process in real time. In this way, the logs generated by each game process can be distinguished, making it easier to query the logs generated by a single game process.
[0047] The log thread can be connected to the log server 102 via the Transfer Control Protocol (TCP). If the log thread fails to connect to the log server 102 and the log thread is disconnected from the log server 102 for a period of time exceeding a preset time, the log thread can write the real-time captured logs to the local game server. During the preset time, the logs captured by the log thread in real time can be stored in the memory queue of the game server. After the log thread successfully reconnects to the log server 102, the log thread can transmit the logs written to the local game server to the log server 102.
[0048] The log server 102 is used to receive and store the real-time logs and disk logs transmitted by the log thread, and realize the aggregation of logs generated by the game process in the game server 101. The storage resources of the log server 102 are separated from the storage resources of the game server 101, so that the storage of logs in the game server 102 does not consume the storage resources of the game server 101.
[0049] The log server 102 may also use various log tools to query the logs generated by the game process in the game server 101 based on the logs stored in the log server 102. The log tool may include multiple commands, such as a command to display all logs in the cluster, a command to display logs with a log level greater than a preset level, a command to display the last n logs of the cluster, a command to compress log files, a command to decompress log files, a command to delete log files, etc. These commands can be adapted to Linux native tools for easy user operation.
[0050] The log server 102 can maintain a separate log file for each game process, so that the logs generated by each game process can be distinguished, which is convenient for querying the logs generated by a single game process. In addition, since each game process in the game server is related, by maintaining a separate log file for each game process, it is also possible to aggregate these log files through a log tool, and then the logs of the game processes can be associated.
[0051] In addition, the log thread can execute the log processing method applicable to the game server side described below. The log server 102 can execute the log processing method applicable to the log server side described below.
[0052] Figure 4 1 is a flow chart of a log processing method according to an embodiment of the present disclosure. The log processing method can process logs generated by a game process on a game server, for example, it can be applicable to a game server deployed in the form of a game zone. The log processing method can be applied to a game server. Figure 4 As shown, the log processing method may include the following steps S41 to S43.
[0053] In step S41, a log thread is started, wherein the log thread is a thread for capturing logs generated by a game process in a game server.
[0054] The logging thread can be started as a thread within the game process, or as a separate process on the game server that is separate from the game process.
[0055] In step S42, the log thread captures the log generated by the game process in the game server to obtain the game process log.
[0056] During the running of the game process, the log thread can capture the logs generated by the game process in real time to obtain the game process log. The captured game process log can be stored in the memory queue of the game server so as to be transmitted to the log server in real time.
[0057] There can be a one-to-one correspondence between log threads and game processes. In this way, the logs generated by each game process can be distinguished, making it easier to query logs for a single game process.
[0058] In step S43, the log thread transmits the game process log to the log server in real time, wherein the storage resources of the log server are separated from the storage resources of the game server and are used to store the game process log transmitted by the log thread as a query log, which can be used to query the log generated by the game process.
[0059] The log thread can transmit the game process log to the log server in real time via TCP.
[0060] The log thread can assemble multiple game process logs together and transmit them to the log server in batches in real time, thereby reducing the number of transmissions.
[0061] By adopting the above technical solution, the log thread can be started, and the log generated by the game process in the game server is captured by the log thread to obtain the game process log and transmit the game process log to the log server in real time, and the storage resources of the log server are separated from the storage resources of the game server and used to store the game process log transmitted by the log thread. Therefore, by real-time transmission and the separation of the log server storage resources and the game server storage resources, the game process log will not consume the storage resources of the game server, greatly saving the storage resources of the game server. Moreover, it is not necessary to transfer the log on the game server to the machine where the ELK log system is located by the filebeat tool as in the related art, greatly saving the CPU resources of the game server.
[0062] In some embodiments, the real-time transmission of the game process log to the log server by the log thread as described in step S43 may include: determining, by the log thread, a unique log sequence number of the game process log; and transmitting, by the log thread, the unique log sequence number together with the log content of the game process log to the log server in real time.
[0063] For each game process log generated by the game process, the log thread can record its unique log sequence number (SequenceNumber, SN). The unique log sequence number can be an unsigned integer, such as a 64-bit unsigned integer. The unique log sequence number can start from 1 and increase, and it is neither repeated nor discontinuous, but increases sequentially. By using the unique log sequence number to number the game process log, it can ensure that each game process log is complete and unique, and it can also achieve the order preservation of all game process logs.
[0064] In case of the initial handshake with the log server after the log thread is started, the determination of the unique log sequence number of the game process log by the log thread may include: the log thread determines, based on the disk log in the game server and the query log in the log server, the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, wherein the disk log is a game process log in the game process log that is written to the storage resource of the game server during the period when the log thread stops transmitting the game process log to the log server in real time.
[0065] The log thread can stop transmitting the game process log to the log server in real time and write the game process log to the storage resources of the game server in at least one of the following situations: a write error occurs on the log server, the memory queue of the game server grows to a preset queue threshold, or the log thread is disconnected from the log server.
[0066] The situation where a write error occurs on the log server and the log thread stops transmitting the game process log to the log server in real time can be called a write error fuse. If a write error occurs when the log server writes the game process log to its storage resource, the log server will immediately return a confirmation message to the log thread and carry a write error flag in the confirmation message. Through the write error flag, the log thread can know that a write error has occurred on the log server. Write errors are usually errors that cannot be recovered in a short time, for example, the storage resources of the log server are full, the local file system of the log server is damaged, etc.
[0067] The situation where the game server's memory queue grows to the preset queue threshold can be called an overload fuse. When the rate at which game process logs are generated continues to be greater than the real-time transmission rate of game process logs to the log server, the game process logs will accumulate in the game server's memory queue, and the accumulation will increase, eventually leading to an overload fuse. In other words, if the log thread cannot handle such a high rate of game process log generation, an overload fuse must be performed, otherwise the game server's memory consumption will continue to grow until the memory is exhausted and the game server crashes. Therefore, when the game server's memory queue grows to the preset queue threshold, an overload fuse will be executed. When the game server's memory queue shrinks back to a controllable queue value, the overload fuse will be closed.
[0068] Figure 5 Schematic diagram of the state machine of the log thread according to the embodiment of the present disclosure. Figure 5 As shown, the state of the log thread includes an idle state, a transmission state, and a disk state, wherein the transmission state refers to the state in which the log thread transmits the game process log to the log server, and the disk state refers to the state in which the log thread stores the game process log to the storage resource of the game server. When the log thread is in an idle state, if the log thread has established a connection with the log server and no fuse has occurred and there are game process logs that need to be transmitted, the log thread will switch from the idle state to the transmission state; if there are newly generated game process logs, and a fuse has occurred or the log server is disconnected from the log thread, the log thread will switch from the idle state to the disk state. When the log thread is in a transmission state, if all game process logs have been transmitted, the log thread will switch from the transmission state to the idle state; if there are untransmitted game process logs, and a fuse has occurred or the log server is disconnected from the log thread, the log thread will switch from the transmission state to the disk state. When the log thread is in the disk state, if all game process logs have been stored, the log thread will switch from the disk state to the idle state.
[0069] By adopting the above technical solution, when determining the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, the disk log in the game server and the query log in the log server are taken into consideration, so that the accuracy of the actual starting unique log sequence number can be ensured, and then the unique log sequence number of the game process log can be accurately determined, ensuring the uniqueness of the unique log sequence number of the game process log, and ensuring the uniqueness and order of the game process log.
[0070] In some embodiments, the log thread determines the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started based on the disk log in the game server and the query log in the log server, which can be achieved in the following way.
[0071] First, the log thread determines the maximum unique log sequence number (CONFIRMED_SN) in the game server's logs as the first maximum unique log sequence number based on the logs in the game server. For example, if the game server has log file 1 (the unique log sequence number of the logs in this file is from 501-600) and log file 2 (the unique log sequence number of the logs in this file is from 1-100), then the first maximum unique log sequence number is 600. In addition, if there is no log file in the storage resources of the game server, the first maximum unique log sequence number is 0.
[0072] The log thread can also determine the maximum unique log sequence number in the game process log recorded by the log thread and not confirmed by the log server to have been stored in the storage resources of the log server as the second maximum unique log sequence number based on the log in the game server. For example, the original log thread stored the game process logs with unique log sequence numbers from 501-600 to the storage resources of the game server during the period when it stopped transmitting the game process logs to the log server in real time, and obtained the log file 1; the original log thread was subsequently destroyed, so a new log thread was restarted on the game server. After the new log thread was started, it did not connect to the log server, so it could not transmit the game process log to the log server in real time. Moreover, because the new log thread does not know the situation between the original log thread and the log server, the new log thread starts numbering the unique log sequence number of the newly generated game process log from 1. During the period when the new log thread cannot transmit the game process log to the log server in real time, it will increase the unique log sequence number from 1 to 1. 00 is written to the storage resource of the game server, and the written log file 2 is obtained. Moreover, since the written log file 2 is written to the disk during the period when the new log thread cannot transmit the game process log to the log server in real time, the log in the written log file 2 is the log that has not been confirmed by the log server to be written to the storage resource of the log server; therefore, in this scenario, on the one hand, since the new log thread does not know the situation between the original log thread and the log server, and on the other hand, since the log in the written log file 2 is the log that has not been confirmed by the log server to be written to the storage resource of the log server, the new log thread will determine the second largest unique log sequence number as 100 based on its own written log file 2 in the game server. In addition, if the new log thread does not have any written log file in the storage resource of the game server, the new log thread will determine the second largest unique log sequence number as 0.
[0073] Then, the log thread determines the first starting unique log sequence number (CLIENT_START_SN) of the latest game process log generated by the game process after the log thread is started this time according to the second largest unique log sequence number. Still taking the original log thread writing to disk log file 1 and the new log thread writing to disk log file 2 as an example, the first starting unique log sequence number is 101.
[0074] Then, the log thread obtains the second starting unique log sequence number determined based on the first maximum unique log sequence number, the first starting unique log sequence number and the third maximum unique log sequence number as the actual starting unique log sequence number (START_SN) of the latest game process log generated by the game process after the log thread is started this time, wherein the third maximum unique log sequence number is the maximum unique log sequence number (SERVER_CONFIRMED_SN) of the query log.
[0075] For example, the log thread can pass the first maximum unique log sequence number and the first starting unique log sequence number to the log server when shaking hands with the log server; the log server determines the third maximum unique log sequence number based on the query log in the storage resource of the log server, and calculates the actual starting unique log sequence number based on the first maximum unique log sequence number, the first starting unique log sequence number and the third maximum unique log sequence number, for example, the actual starting unique log sequence number = max (third maximum unique log sequence number, first maximum unique log sequence number) + first starting unique log sequence number. The log server can then return the calculated actual starting unique log sequence number to the log thread. Of course, it is also feasible for the actual starting unique log sequence number to be calculated by the log thread. Still taking the original log thread dropping the log file 1 and the new log thread dropping the log file 2 as an example, if the third maximum unique log sequence number is 550, the actual starting unique log sequence number is 701.
[0076] By adopting the above technical solution, the accuracy of the actual starting unique log sequence number can be ensured, and the unique log sequence number of the game process log can be accurately determined, ensuring the uniqueness of the unique log sequence number of the game process log, and ensuring the uniqueness and order of the game process log.
[0077] In some embodiments, the log processing method according to the embodiment of the present disclosure may also include: the log thread corrects the unique log number of the game process log recorded by the log thread and not confirmed by the log server to have been stored in the storage resource of the log server according to the actual starting unique log number and the first starting unique log number.
[0078] For example, the compensation value to be corrected is the actual starting unique log serial number minus the first starting unique log serial number. The log thread adds the calculated compensation value to the unique log serial number of the game process log recorded by the log thread and not confirmed by the log server to be stored in the storage resource of the log server, so as to realize the correction of these unique log serial numbers. Still taking the original log thread storing the disk log file 1 and the new log thread storing the disk log file 2 as an example, the unique log serial number of the game process log in the disk log file 2 is corrected to 601-700.
[0079] By adopting the above technical solution, the unique log serial number of the game process log can be accurately determined, ensuring the uniqueness of the unique log serial number of the game process log, thereby ensuring the uniqueness and sequence preservation of the game process log.
[0080] In some embodiments, the log thread performs a reconnection handshake with the log server after the initial handshake. Then, the log processing method according to the embodiment of the present disclosure may also include: the log thread determines the smallest unique log sequence number in the memory queue of the game server; the log thread obtains the starting synchronization log sequence number determined according to the smallest unique log sequence number and the largest unique log sequence number of the query log; the log thread transmits the corresponding game process log to the log server in real time starting from the starting synchronization log sequence number.
[0081] For example, the log thread can pass the determined minimum unique log sequence number in the memory queue of the game server to the log server; the log server can determine the maximum unique log sequence number of the query log, and determine the starting synchronization log sequence number based on the minimum unique log sequence number and the maximum unique log sequence number of the query log, for example, the starting synchronization log sequence number = max (maximum unique log sequence number of the query log, minimum unique log sequence number in the memory queue of the game server) + 1. The log server can then return the starting synchronization log sequence number to the log thread. Of course, it is also feasible for the starting synchronization log sequence number to be calculated by the log thread.
[0082] By adopting the above technical solution, the real starting synchronization log sequence number can be determined after the log thread reconnects with the log server, and the corresponding game process log can be transmitted to the log server in real time starting from the starting synchronization log sequence number, thereby improving transmission efficiency.
[0083] In some embodiments, the log processing method according to the embodiment of the present disclosure may also include: the log thread controls the transmission flow of the game process log to be lower than the preset transmission flow, wherein the preset transmission flow is the transmission flow of the game logic control message that does not affect the transmission of the game process.
[0084] For example, a sliding window can be used to control the transmission flow between the log thread and the log server. Otherwise, although the underlying TCP has flow control, it is still possible that the TCP buffer is filled with the game process log and the important game logic control message is difficult to send out. In the game process, the game logic control message should be sent first, and the game process log can be sent with a certain network delay, so the transmission of the game process log can be designed to account for only the preset transmission flow (for example, 25% of the total transmission flow) at most. In actual implementation, assuming that the target log request per second (Query Per Second, QPS) of a single game process is 10,000 / S, the log server returns a confirmation message to the log thread every 200ms, and the confirmation message is used to confirm the game process log stored in the storage resource of the log server. Then, the log window size can be set to, for example, 500 by default to ensure that the QPS of the game process log does not exceed 2.5K / S.
[0085] By performing flow control on the transmission of the game process log, the transmission of the game logic control message of the game process can be maintained.
[0086] In some embodiments, the log processing method according to the embodiment of the present disclosure may further include: the log thread transmits the real-time game process log and the game process log written to the disk to the log server through different channels. In this way, the log server can know whether the log thread transmits the real-time game process log or the game process log written to the disk in the game server according to the transmission channel.
[0087] In some embodiments, the log thread can use Figure 6 The transmission message structure shown is used to transmit the game process log to the log server. Figure 6 As shown, the transmission message structure includes a packet header 61 and log information 62 .
[0088] The packet header 61 includes a unique log sequence number range, which is used to indicate the range of the game process logs transmitted this time. For example, the unique log sequence number range 101-200 can indicate the game process logs transmitted this time from the unique log sequence number 101 to the unique log sequence number 200. Through the unique log sequence number range, the log server side can verify whether the number of transmitted game process logs is correct after receiving them.
[0089] The header 61 may also include at least one of a version number, a message number, a channel number, and a flag. The version number may be used to indicate the version of the custom communication protocol used by the log thread and the log server. The message number may be used to indicate the type of message transmitted, such as a handshake message, a log message, etc. The channel number may be used to indicate the channel used for transmission. The real-time game process log and the game process log dropped on the game server may be transmitted using different channels. Each channel identifies an independent transmission, and these channels may be transmitted concurrently. The flag may be used to mark special nodes such as the start of log transmission and the end of log transmission.
[0090] The log information 62 may include multiple game process logs 621 to 62 n The number of game process logs included in the log information 62 should be the same as the number indicated by the unique log sequence number range. Each game process log may include log content, and may also include at least one of a log timestamp, a log level, a log length, etc. The log level may include, for example, Info, Error, etc.
[0091] pass Figure 6 The transmission message structure shown, the log server can determine the number of game process logs transmitted this time, game process log related information, etc. after receiving it.
[0092] In some embodiments, if the log thread needs to be closed, the log thread will be closed only after all game process logs have been transmitted to the log server in real time or stored in the storage resource of the game server, or the log thread will be forced to close after waiting for a period of time. In this way, it can be ensured that the game process logs are not lost.
[0093] Figure 7 1 is a flow chart of a log processing method according to an embodiment of the present disclosure. The log processing method can process logs generated by a game process on a game server, for example, it can be applied to a game server deployed in the form of a game zone. The log processing method can be applied to a log server. The storage resources of the log server are separated from the storage resources of the game server. Figure 7 As shown, the log processing method according to the embodiment of the present disclosure may include the following steps S71 to S73.
[0094] In step S71, the game process log information transmitted in real time by the receiving log thread when the game process in the game server is running, wherein the log thread is a thread on the game server that captures the logs generated by the game process, and the game process log information includes the game process log, which is the log generated by the game process.
[0095] In step S72, the received game process log is stored in the storage resource of the log server to obtain a query log.
[0096] The log server can assemble multiple game process logs together and write them in batches to the storage resources of the log server, thereby reducing the number of calls to write to the file system.
[0097] In step S73, the log generated by the game process is queried based on the query log.
[0098] By adopting the above technical scheme, the game process log information transmitted in real time when the game process in the game server is running can be received by the log thread, the received game process log is stored in the storage resources of the log server, the query log is obtained, and the log generated by the game process is queried based on the query log. Therefore, by real-time transmission and the separation of the log server storage resources and the game server storage resources, the game process log will not consume the storage resources of the game server, which greatly saves the storage resources of the game server. Moreover, it is not necessary to transfer the log on the game server to the machine where the ELK log system is located by the filebeat tool as in the related art, which greatly saves the CPU resources of the game server.
[0099] In some embodiments, the game process log information also includes a unique log sequence number of the game process log. Then, the log processing method according to the embodiment of the present disclosure may also include: after storing the game process log in the storage resource of the log server, sending a confirmation message to the log thread, the confirmation message includes the unique log sequence number, which is used to indicate to the log thread that the corresponding game process log has been stored in the log server.
[0100] For example, the log server can return a confirmation message to the log thread every preset period (e.g., 200ms). The confirmation message can be used to confirm the unique log sequence number of the game process log that is finally stored in the storage resources of the log server. For example, the unique log sequence number of the game process log that is finally stored in the storage resources of the log server is 200, and the unique log sequence number carried in the confirmation message that the log server returns to the log thread is 201, so the log thread can know that the unique log sequence number is that all game process logs before 201 have been stored in the storage resources of the log server, and therefore, the log thread can delete the corresponding game process log after receiving the confirmation message. In this way, the storage resources of the game server can be saved.
[0101] In some embodiments, the log server may use Figure 8 The transmission message structure shown is used to transmit confirmation messages to the log thread. Figure 8As shown, the transmission message structure includes a confirmation message field. The transmission message structure can also include at least one of a version number, a message number, a channel number, and a flag bit. The version number can be used to indicate the version of the custom communication protocol used by the log thread and the log server. The message number can be used to indicate the type of message transmitted, such as a handshake message, a log message, etc. The channel number can be used to indicate the channel used for the transmission. The flag bit can be used to mark, for example, a write error. The write error has been described in detail in the previous text and will not be repeated here.
[0102] Through the above transmission message structure, the log thread can know the message that the log server wants to transmit.
[0103] In some embodiments, the log processing method according to the embodiment of the present disclosure may also include: storing a separate log file for each game process, the log file includes a log meta information file and a log content file, the log content file is used to store the log content of the game process log, and the log meta information file is used to store the meta information of the game process log. The log meta information file and the log content file are one-to-one corresponding. In addition, the log file can be named according to time.
[0104] Fig. 9 FIG. 2 shows a schematic diagram of the structure of a log meta information file according to an embodiment of the present disclosure. Fig. 9 As shown, the log meta information file includes a file header 91 and log meta information 92. The file header 91 includes a unique log sequence number range, which is used to indicate the range of the game process log recorded in the log meta information file. The file header 91 may also include a version number field, which is used to indicate the version of the log meta information file. The log meta information 92 includes meta information of multiple game process logs, and the number of the logs is the same as the number indicated by the unique log sequence number range. The log meta information 92 may include the position of the log in the log content file and the log timestamp. The log meta information 92 may also include at least one of the log level and the log length.
[0105] By storing a separate log file for each game process, the log of the specified game process can be quickly located when the user wants to query the specified game process. The general ELK log system will write the logs of all game processes in a cluster into the same log file, and filter out the log of the specified game process from this log file when querying the log of the specified game process, so the query time is long. In addition, in the present disclosure, the query speed can be accelerated and the space required for storing logs can be reduced through the log meta information file. For example, the log meta information file only needs 1 byte to record the log level, while if the log content is used to record the log level such as Info and Error, it will take several bytes.
[0106] In some embodiments, the query of the log generated by the game process based on the query log described in step S73 can be implemented in the following manner. First, the corresponding log file is determined according to the log query request. Then, according to the log query request, based on the log meta information file in the corresponding log file, the game process log to be queried is determined. Then, the log content of the determined game process log to be queried is obtained from the log content file in the corresponding log file.
[0107] Take the log query request of "query the logs from 11:10 to 11:30 on August 19, 2024" as an example. First, locate the corresponding log file according to the time information in the log file name. Then, according to the timestamp information in the log meta-information file of the corresponding log file, search for the timestamp that falls within the time range in the log query request. This can be searched by binary search to improve the search efficiency. Then, based on the found timestamp, the "position of the log in the log content file" information contained in the meta-information to which the timestamp belongs can be obtained. Then, based on the "position of the log in the log content file" information, the corresponding log content can be found from the corresponding log content file.
[0108] In addition, when the log query request includes log queries for multiple game processes, the obtained game process logs can also be merged and sorted for multiple game processes to achieve the effect of aggregating the logs of multiple game processes on demand. For example, the game process logs of all game processes found are aggregated and merged in chronological order. In this way, the logs of the game server can be sorted in chronological order, which is convenient for troubleshooting. Moreover, the context can be displayed in order according to the log time.
[0109] By adopting the above technical solution, the query of the game process log can be realized. Moreover, the log query rule is simple and the query efficiency is high.
[0110] In some embodiments, when the log thread performs an initial handshake with the log server after being started, the log processing method according to the embodiment of the present disclosure can also implement the determination of the unique log sequence number of the game process log in the following manner.
[0111] First, obtain the disk log information of the disk log in the game server from the log thread, where the disk log is the game process log in the game process log, which is written to the storage resource of the game server during the period when the log thread stops transmitting the game process log to the log server in real time.
[0112] Then, based on the log information and the query log, the actual starting unique log number of the latest game process log generated by the game process after the log thread is started is determined, wherein the actual starting unique log number is used by the log thread to determine the starting unique log number of the latest game process log generated by the game process after the log thread is started, and / or to correct the unique log number of the game process log recorded by the log thread and which the log server has not confirmed to have been stored in the storage resource of the log server.
[0113] Then, the actual starting unique log sequence number is sent to the log thread.
[0114] The specific implementation method of each step in this implementation method has been described in detail in the log processing method for the game server, and will not be repeated here.
[0115] By adopting the above technical solution, when determining the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, the disk log in the game server and the query log in the log server are taken into consideration, so that the accuracy of the actual starting unique log sequence number can be ensured, and then the unique log sequence number of the game process log can be accurately determined, ensuring the uniqueness of the unique log sequence number of the game process log, and ensuring the uniqueness and order of the game process log.
[0116] In some embodiments, the log information dropped to disk includes a first maximum unique log sequence number and a first starting unique log sequence number. The first maximum unique log sequence number is the maximum unique log sequence number in the dropped log determined by the log thread based on the dropped log. The first starting unique log sequence number is the starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, determined by the log thread based on the second maximum unique log sequence number. The second maximum unique log sequence number is the maximum unique log sequence number in the game process log that the log thread records and that the log server has not confirmed to have been stored in the storage resource of the log server, determined by the log thread based on the dropped log. Then, the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, determined based on the dropped log information and the query log, may include the following steps.
[0117] First, the log server determines the maximum unique log sequence number of the query log, and obtains the third maximum unique log sequence number.
[0118] Then, the log server determines the second starting unique log sequence number based on the first maximum unique log sequence number, the first starting unique log sequence number and the third maximum unique log sequence number, and obtains the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started this time. The actual starting unique log sequence number is used by the log thread to determine the starting unique log sequence number of the latest game process log generated by the game process after the log thread is started this time, and can also be used by the log thread to correct the unique log sequence number of the game process log recorded by the log thread and not confirmed by the log server to have been stored in the storage resource of the log server.
[0119] The specific implementation method of each step in this implementation method has been described in detail in the log processing method for the game server, and will not be repeated here.
[0120] By adopting the above technical solution, the unique log serial number of the game process log can be accurately determined, ensuring the uniqueness of the unique log serial number of the game process log, thereby ensuring the uniqueness and sequence preservation of the game process log.
[0121] In some embodiments, in the case where a reconnection handshake is performed after the log thread and the log server have an initial handshake, the log processing method according to the embodiment of the present disclosure may also include: receiving the smallest unique log sequence number in the memory queue of the game server from the log thread; determining the largest unique log sequence number of the query log; determining the starting synchronization log sequence number based on the smallest unique log sequence number and the largest unique log sequence number of the query log; and sending the starting synchronization log sequence number to the log thread, wherein the starting synchronization log sequence number is used by the log thread to determine the real-time transmission of the corresponding game process log to the log server starting from the starting synchronization log sequence number.
[0122] The specific implementation method of each step in this implementation method has been described in detail in the log processing method for the game server, and will not be repeated here.
[0123] By adopting the above technical solution, the real starting synchronization log sequence number can be determined after the log thread reconnects with the log server, so that the log thread starts from the starting synchronization log sequence number and transmits the corresponding game process log to the log server in real time, thereby improving the transmission efficiency.
[0124] In some embodiments, if the log server needs to be shut down, the log server will prohibit all log writing, send a shutdown message to the log thread, and carry the last confirmation message to the log thread in the shutdown message. The log thread processes the received shutdown message and actively disconnects from the log server. The log server will wait until all connections are actively disconnected and the background callback is processed before exiting, or it will force exit after waiting for a period of time. In this way, it can ensure that the game process log is not lost.
[0125] In some embodiments, the log processing method according to the embodiment of the present disclosure may further include: maintaining a session for each log thread, and executing the session in a coroutine manner for each session.
[0126] Fig.10 is a schematic diagram of executing a session in a coroutine manner according to an embodiment of the present disclosure. Fig.10 As shown, each session may include, for example, callback coroutine 1001, read coroutine 1002, confirm coroutine 1003, write coroutine 1004 and other coroutines 1000. Callback coroutine 1001 may be used to execute task callback. Read coroutine 1002 may read and distribute game process logs when the log thread transmits game process logs. Confirm coroutine 1003 may be used to return a confirmation message to the log thread. Write coroutine 1004 may be used to write content to the storage resources of the log server.
[0127] Through the coroutine method, concurrent processing can be achieved and the efficiency of log processing can be improved.
[0128] Fig.11 is a schematic block diagram of a game server according to an embodiment of the present disclosure. The game server can process logs generated by a game process on the game server, for example, it can be applicable to a game server deployed in the form of a game zone. Fig.11 As shown, the game server 101 includes: a startup module 1102, which is used to start a log thread, wherein the log thread is a thread for capturing logs generated by a game process in the game server; a log thread 1103, which is used to capture logs generated by a game process in the game server, obtain game process logs, and transmit the game process logs to the log server in real time, wherein the storage resources of the log server are separated from the storage resources of the game server and are used to store the game process logs transmitted by the log thread as query logs, and the query logs can be used to implement queries on logs generated by the game process.
[0129] By adopting the above technical solution, it is possible to start the log thread, capture the log generated by the game process in the game server by the log thread to obtain the game process log and transmit the game process log to the log server in real time, and the storage resources of the log server are separated from the storage resources of the game server and are used to store the game process log transmitted by the log thread. Therefore, by real-time transmission and the separation of the log server storage resources and the game server storage resources, the game process log will not consume the storage resources of the game server, greatly saving the storage resources of the game server. Moreover, it is not necessary to transfer the log on the game server to the machine where the ELK log system is located by the filebeat tool as in the related art, greatly saving the CPU resources of the game server.
[0130] Optionally, the log thread 1103 transmits the game process log to the log server in real time, including: the log thread 1103 determines the unique log sequence number of the game process log; the log thread 1103 transmits the unique log sequence number and the log content of the game process log to the log server in real time.
[0131] Optionally, after log thread 1103 is started and shakes hands with the log server for the first time, log thread 1103 determines the unique log number of the game process log, including: log thread 1103 determines the actual starting unique log number of the latest game process log generated by the game process after log thread 1103 is started, based on the disk log in the game server and the query log in the log server, wherein the disk log is a game process log in the game process log that is written to the storage resources of the game server during the period when log thread 1103 stops transmitting the game process log to the log server in real time.
[0132] Optionally, the log thread 1103 determines the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started according to the disk log in the game server and the query log in the log server, including:
[0133] The log thread 1103 determines, based on the disk log in the game server, the maximum unique log sequence number in the disk log as the first maximum unique log sequence number and the maximum unique log sequence number in the game process log recorded by the log thread and not confirmed by the log server to have been stored in the storage resource of the log server as the second maximum unique log sequence number; the log thread 1103 determines, based on the second maximum unique log sequence number, the first starting unique log sequence number of the latest game process log generated by the game process after the log thread is started this time; the log thread 1103 obtains the second starting unique log sequence number determined based on the first maximum unique log sequence number, the first starting unique log sequence number and the third maximum unique log sequence number as the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started this time, wherein the third maximum unique log sequence number is the maximum unique log sequence number of the query log.
[0134] Optionally, the log thread 1103 further modifies the unique log sequence number of the game process log recorded by the log thread and not confirmed by the log server to have been stored in the storage resource of the log server according to the actual starting unique log sequence number and the first starting unique log sequence number.
[0135] Optionally, after the initial handshake between the log thread and the log server, a reconnection handshake is performed, and the log thread 1103 is also used to: determine the smallest unique log sequence number in the memory queue of the game server; obtain the starting synchronization log sequence number determined based on the smallest unique log sequence number and the largest unique log sequence number of the query log; starting from the starting synchronization log sequence number, the corresponding game process log is transmitted to the log server in real time.
[0136] Optionally, the game server 101 further includes a flow control module for controlling the transmission flow of the game process log to be lower than a preset transmission flow, wherein the preset transmission flow is the transmission flow of the game logic control message that does not affect the transmission of the game process.
[0137] Optionally, the log thread 1103 is also used to stop transmitting the game process log to the log server in real time and write the game process log to the storage resources of the game server in at least one of the following situations: a write error occurs on the log server, the memory queue of the game server grows to a preset queue threshold, and the log thread is disconnected from the log server.
[0138] Optionally, the log thread 1103 is further used to transmit the real-time game process log and the game process log written to the disk to the log server through different channels.
[0139] Optionally, the log thread 1103 corresponds one-to-one to the game process.
[0140] The specific implementation of the operations performed by each module in the game server according to the embodiment of the present disclosure has been described in detail in the relevant method and will not be repeated here.
[0141] Fig.12 1 is a schematic block diagram of a log server according to an embodiment of the present disclosure. The log server can process logs generated by a game process on a game server, for example, it can be applicable to a game server deployed in the form of a game zone. Fig.12 As shown, the log server 102 includes: a receiving module 1202, which is used to receive game process log information transmitted in real time by the log thread when the game process in the game server is running, wherein the log thread is a thread on the game server that captures the log generated by the game process, and the game process log information includes the game process log, which is the log generated by the game process. The storage resources of the log server 102 are separated from the storage resources of the game server; a storage module 1203, which is used to store the received game process log in the storage resources of the log server 102 to obtain a query log; and a query module 1204, which is used to query the log generated by the game process based on the query log.
[0142] By adopting the above technical scheme, the game process log information transmitted in real time when the game process in the game server is running can be received by the log thread, the received game process log is stored in the storage resources of the log server, the query log is obtained, and the log generated by the game process is queried based on the query log. Therefore, by real-time transmission and the separation of the log server storage resources and the game server storage resources, the game process log will not consume the storage resources of the game server, which greatly saves the storage resources of the game server. Moreover, it is not necessary to transfer the log on the game server to the machine where the ELK log system is located by the filebeat tool as in the related art, which greatly saves the CPU resources of the game server.
[0143] Optionally, the game process log information also includes a unique log serial number of the game process log, and the log server 102 also includes a first sending module, which is used to: after storing the game process log in the storage resources of the log server, send a confirmation message to the log thread, and the confirmation message includes a unique log serial number, which is used to indicate to the log thread that the corresponding game process log has been stored in the log server.
[0144] Optionally, the storage module 1203 is also used to store a separate log file for each game process, the log file including a log meta-information file and a log content file, the log content file is used to store the log content of the game process log, and the log meta-information file is used to store the meta-information of the game process log.
[0145] Optionally, the query module 1204 queries the log generated by the game process based on the query log, including: determining the corresponding log file according to the log query request; determining the game process log to be queried based on the log meta-information file in the corresponding log file according to the log query request; obtaining the log content of the determined game process log to be queried from the log content file in the corresponding log file.
[0146] Optionally, the log query request includes log queries for multiple game processes, and the query module 1204 is further used to merge and sort the acquired game process logs for the multiple game processes.
[0147] Optionally, after the log thread is started and shakes hands with the log server for the first time, the log server 102 also includes: a first acquisition module, used to obtain the disk log information of the disk log in the game server from the log thread, wherein the disk log is a game process log in the game process log that is stored in the storage resources of the game server during the period when the log thread stops transmitting the game process log to the log server in real time; a first determination module, used to determine the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started based on the disk log information and the query log, wherein the actual starting unique log sequence number is used by the log thread to determine the starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, and / or to correct the unique log sequence number of the game process log recorded by the log thread and not confirmed by the log server to have been stored in the storage resources of the log server; a second sending module, used to send the actual starting unique log sequence number to the log thread.
[0148] Optionally, the disk-dropped log information includes a first maximum unique log sequence number and a first starting unique log sequence number, wherein the first maximum unique log sequence number is the maximum unique log sequence number in the disk-dropped log determined by the log thread according to the disk-dropped log, the first starting unique log sequence number is the starting unique log sequence number of the latest game process log generated by the game process after the log thread is started and determined by the log thread according to the second maximum unique log sequence number, and the second maximum unique log sequence number is the maximum unique log sequence number in the game process log recorded by the log thread and not confirmed to have been stored in the storage resource of the log server by the log thread according to the disk-dropped log; then, the first determination module determines the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started according to the disk-dropped log information and the query log, including: determining the maximum unique log sequence number of the query log to obtain the third maximum unique log sequence number; determining the second starting unique log sequence number according to the first maximum unique log sequence number, the first starting unique log sequence number and the third maximum unique log sequence number to obtain the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started this time.
[0149] Optionally, after the initial handshake between the log thread and the log server, a reconnection handshake is performed, and the log server 102 also includes: a first receiving module, used to receive the smallest unique log sequence number in the memory queue of the game server from the log thread; a second determining module, used to determine the largest unique log sequence number of the query log, and determine the starting synchronization log sequence number according to the smallest unique log sequence number and the largest unique log sequence number of the query log; a third sending module, used to send the starting synchronization log sequence number to the log thread, wherein the starting synchronization log sequence number is used by the log thread to determine the real-time transmission of the corresponding game process log to the log server starting from the starting synchronization log sequence number.
[0150] Optionally, the log server 102 further includes a maintenance module, which is used to: maintain a session for each log thread, and execute the session in a coroutine manner for each session.
[0151] The specific implementation of the operations performed by each module in the log server according to the embodiment of the present disclosure has been described in detail in the relevant method, and will not be repeated here.
[0152] The present disclosure also provides a computer-readable medium having a computer program stored thereon, and when the computer program is executed by a processing device, the steps of any method in the present disclosure are implemented.
[0153] The present disclosure also provides an electronic device, comprising:
[0154] a storage device having a computer program stored thereon;
[0155] A processing device is used to execute a computer program in a storage device to implement the steps of any method in the present disclosure.
[0156] The present disclosure also provides a computer program product, comprising a computer program, which implements the steps of any method in the present disclosure when the computer program is executed by a processor.
[0157] Reference below Fig.13 , which shows a schematic diagram of the structure of an electronic device 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.13 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0158] like Fig.13 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0159] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.13 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0160] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0161] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0162] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0163] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0164] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: starts a log thread, wherein the log thread is a thread for capturing logs generated by a game process in the game server; the log thread captures the logs generated by the game process to obtain a game process log; the log thread transmits the game process log to a log server in real time, wherein the storage resources of the log server are separated from the storage resources of the game server and are used to store the game process logs transmitted by the log thread as query logs, and the query logs can be used to query the logs generated by the game process.
[0165] Alternatively, the computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: receives game process log information transmitted in real time by the log thread when the game process in the game server is running, wherein the log thread is a thread on the game server that captures the log generated by the game process, the game process log information includes a game process log, and the game process log is a log generated by the game process. The storage resources of the log server are separate from the storage resources of the game server; stores the received game process log in the storage resources of the log server to obtain a query log; and queries the log generated by the game process based on the query log.
[0166] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0167] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0168] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a module does not limit the module itself in some cases. For example, the first acquisition module may also be described as "a module for acquiring the log generated by the game process in the game server to obtain the game process log".
[0169] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0170] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0171] According to one or more embodiments of the present disclosure, Example 1 provides a log processing method, which is applied to a game server, and the method includes: starting a log thread, wherein the log thread is a thread for capturing logs generated by a game process in the game server; the log thread captures the logs generated by the game process to obtain a game process log; the log thread transmits the game process log to a log server in real time, wherein the storage resources of the log server are separated from the storage resources of the game server and are used to store the game process logs transmitted by the log thread as query logs, and the query logs can be used to implement queries on the logs generated by the game process.
[0172] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, wherein the log thread transmits the game process log to the log server in real time, including: the log thread determines the unique log sequence number of the game process log; the log thread transmits the unique log sequence number together with the log content of the game process log to the log server in real time.
[0173] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 2, wherein the log thread shakes hands with the log server for the first time after being started, and the determination of the unique log sequence number of the game process log by the log thread includes: the log thread determines, based on the disk log in the game server and the query log in the log server, the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, wherein the disk log is a game process log in the game process log that is written to the storage resource of the game server during the period when the log thread stops transmitting the game process log to the log server in real time.
[0174] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 3, wherein the log thread determines the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started according to the disk log in the game server and the query log in the log server, including: the log thread determines the maximum unique log sequence number in the disk log as the first maximum unique log sequence number and the maximum unique log sequence number in the game process log recorded by the log thread and not confirmed by the log server to have been stored in the storage resource of the log server as the second maximum unique log sequence number according to the disk log in the game server; the log thread determines the first starting unique log sequence number of the latest game process log generated by the game process after the log thread is started according to the second maximum unique log sequence number; the log thread obtains the second starting unique log sequence number determined according to the first maximum unique log sequence number, the first starting unique log sequence number and the third maximum unique log sequence number as the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, wherein the third maximum unique log sequence number is the maximum unique log sequence number of the query log.
[0175] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 4, wherein the method further includes: the log thread corrects the unique log number of the game process log recorded by the log thread and not confirmed by the log server to have been stored in the storage resource of the log server based on the actual starting unique log number and the first starting unique log number.
[0176] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 2, wherein the log thread performs a reconnection handshake with the log server after the initial handshake, and the method further includes: the log thread determines the smallest unique log sequence number in the memory queue of the game server; the log thread obtains the starting synchronization log sequence number determined based on the smallest unique log sequence number and the largest unique log sequence number of the query log; and the log thread transmits the corresponding game process log to the log server in real time starting from the starting synchronization log sequence number.
[0177] According to one or more embodiments of the present disclosure, Example 7 provides a method of any one of Examples 1 to 6, wherein the method further includes: controlling the transmission flow of the game process log to be lower than a preset transmission flow, wherein the preset transmission flow is a transmission flow that does not affect the transmission of the game logic control message of the game process.
[0178] According to one or more embodiments of the present disclosure, Example 8 provides a method of any one of Examples 1 to 6, wherein the method further includes: in at least one of the following situations, the log thread stops transmitting the game process log to the log server in real time and writes the game process log to the storage resource of the game server: a write error occurs on the log server, the memory queue of the game server grows to a preset queue threshold, and the log thread is disconnected from the log server.
[0179] According to one or more embodiments of the present disclosure, Example 9 provides the method of Example 8, wherein the method further includes: the log thread transmits the real-time game process log and the game process log written to the disk to the log server through different channels.
[0180] According to one or more embodiments of the present disclosure, Example 10 provides the method of any one of Examples 1 to 6, wherein the log thread corresponds to the game process one by one.
[0181] According to one or more embodiments of the present disclosure, Example 10 provides a log processing method, which is applied to a log server, and the method includes: receiving game process log information transmitted in real time by a log thread when a game process in the game server is running, wherein the log thread is a thread on the game server that captures logs generated by the game process, and the game process log information includes a game process log, and the game process log is a log generated by the game process, and the storage resources of the log server are separated from the storage resources of the game server; storing the received game process log in the storage resources of the log server to obtain a query log; and querying the log generated by the game process based on the query log.
[0182] According to one or more embodiments of the present disclosure, Example 12 provides the method of Example 11, wherein the game process log information also includes a unique log sequence number of the game process log, and the method further includes: after storing the game process log in the storage resources of the log server, sending a confirmation message to the log thread, wherein the confirmation message includes the unique log sequence number, which is used to indicate to the log thread that the corresponding game process log has been stored in the log server.
[0183] According to one or more embodiments of the present disclosure, Example 13 provides the method of Example 11 or 12, wherein the method further includes: storing a separate log file for each of the game processes, the log file including a log meta-information file and a log content file, the log content file being used to store the log content of the game process log, and the log meta-information file being used to store the meta-information of the game process log.
[0184] According to one or more embodiments of the present disclosure, Example 14 provides the method of Example 13, wherein the querying of the log generated by the game process based on the query log includes: determining the corresponding log file according to the log query request; determining the game process log to be queried based on the log meta-information file in the corresponding log file according to the log query request; and obtaining the log content of the determined game process log to be queried from the log content file in the corresponding log file.
[0185] According to one or more embodiments of the present disclosure, Example 15 provides the method of Example 14, wherein the log query request includes a log query for multiple game processes, and the method further includes: merging and sorting the acquired game process logs for the multiple game processes.
[0186] According to one or more embodiments of the present disclosure, Example 16 provides the method of Example 12, wherein the log thread performs an initial handshake with the log server after being started, and the method further includes: obtaining disk log information of the disk log in the game server from the log thread, wherein the disk log is a game process log in the game process log that is stored in the storage resource of the game server during the period when the log thread stops transmitting the game process log to the log server in real time; determining the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started based on the disk log information and the query log, wherein the actual starting unique log sequence number is used by the log thread to determine the starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, and / or to correct the unique log sequence number of the game process log recorded by the log thread that the log server has not confirmed to have been stored in the storage resource of the log server; and sending the actual starting unique log sequence number to the log thread.
[0187] According to one or more embodiments of the present disclosure, Example 17 provides the method of Example 16, wherein the disk-falling log information includes a first maximum unique log sequence number and a first starting unique log sequence number, wherein the first maximum unique log sequence number is the maximum unique log sequence number in the disk-falling log determined by the log thread according to the disk-falling log, the first starting unique log sequence number is the starting unique log sequence number of the latest game process log generated by the game process after the log thread is started and determined by the log thread according to the second maximum unique log sequence number, and the second maximum unique log sequence number is the maximum unique log sequence number in the game process log determined by the log thread according to the disk-falling log and recorded by the log thread but not confirmed to have been stored in the storage resource of the log server;
[0188] Then, determining the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started according to the disk log information and the query log includes:
[0189] Determine the maximum unique log sequence number of the query log to obtain a third maximum unique log sequence number; determine the second starting unique log sequence number based on the first maximum unique log sequence number, the first starting unique log sequence number and the third maximum unique log sequence number, and obtain the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started this time.
[0190] According to one or more embodiments of the present disclosure, Example 18 provides the method of Example 12, wherein the log thread performs a reconnection handshake with the log server after the initial handshake, and the method further includes: receiving the smallest unique log sequence number in the memory queue of the game server from the log thread; determining the largest unique log sequence number of the query log; determining the starting synchronization log sequence number based on the smallest unique log sequence number and the largest unique log sequence number of the query log; sending the starting synchronization log sequence number to the log thread, wherein the starting synchronization log sequence number is used by the log thread to determine the real-time transmission of the corresponding game process log to the log server starting from the starting synchronization log sequence number.
[0191] According to one or more embodiments of the present disclosure, Example 19 provides the method of any one of Examples 11 to 18, wherein the method further includes: maintaining a session for each of the log threads, and executing the session in a coroutine manner for each session.
[0192] According to one or more embodiments of the present disclosure, Example 20 provides a game server, comprising a startup module and a log process, wherein: the startup module is used to start the log thread, wherein the log thread is a thread for capturing logs generated by a game process in the game server; the log thread is used to capture the logs generated by the game process, obtain the game process logs, and transmit the game process logs to the log server in real time, wherein the storage resources of the log server are separated from the storage resources of the game server and are used to store the game process logs transmitted by the log thread as query logs, and the query logs can be used to implement queries on the logs generated by the game process.
[0193] According to one or more embodiments of the present disclosure, Example 21 provides a log server, comprising: a receiving module, used to receive game process log information transmitted in real time by a log thread when a game process in a game server is running, wherein the log thread is a thread on the game server that captures logs generated by the game process, and the game process log information includes a game process log, and the game process log is a log generated by the game process, and the storage resources of the log server are separated from the storage resources of the game server; a storage module, used to store the received game process log in the storage resources of the log server to obtain a query log; and a query module, used to query the log generated by the game process based on the query log.
[0194] According to one or more embodiments of the present disclosure, Example 22 provides a log system, including: a game server, used to execute the log processing method according to any one of Examples 1 to 10; a log server, used to execute the log processing method according to any one of Examples 11 to 19.
[0195] According to one or more embodiments of the present disclosure, Example 23 provides a computer-readable medium having a computer program stored thereon, which implements the steps of any of the methods described in Examples 1-19 when executed by a processing device.
[0196] According to one or more embodiments of the present disclosure, Example 24 provides an electronic device, comprising: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of any one of the methods described in Examples 1-19.
[0197] According to one or more embodiments of the present disclosure, Example 25 provides a computer program product, including a computer program, which implements the steps of any one of the methods of Examples 1 to 19 when executed by a processor.
[0198] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0199] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0200] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Claims
1. A log processing method, characterized in that: Applied to a game server, the method comprises: Starting a log thread, wherein the log thread is a thread for capturing logs generated by a game process in the game server; The log thread captures the log generated by the game process to obtain the game process log; The log thread transmits the game process log to the log server in real time, wherein the storage resources of the log server are separated from the storage resources of the game server and are used to store the game process log transmitted by the log thread as a query log, and the query log can be used to query the log generated by the game process.
2. The method according to claim 1, characterized in that The log thread transmits the game process log to the log server in real time, including: Determining the unique log sequence number of the game process log by the log thread; The log thread transmits the unique log sequence number together with the log content of the game process log to the log server in real time.
3. The method according to claim 2, characterized in that After the log thread is started, it shakes hands with the log server for the first time, and the log thread determines the unique log sequence number of the game process log, including: The log thread determines, based on the disk log in the game server and the query log in the log server, the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, wherein the disk log is a game process log in the game process log that is written to the storage resource of the game server during the period when the log thread stops transmitting the game process log to the log server in real time.
4. The method according to claim 3, characterized in that The log thread determines, according to the disk log in the game server and the query log in the log server, the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, including: The log thread determines, based on the disk log in the game server, the maximum unique log sequence number in the disk log as the first maximum unique log sequence number and the maximum unique log sequence number in the game process log recorded by the log thread and not confirmed by the log server to have been stored in the storage resource of the log server as the second maximum unique log sequence number; The log thread determines, according to the second largest unique log sequence number, a first starting unique log sequence number of the latest game process log generated by the game process after the log thread is started; The log thread obtains a second starting unique log sequence number determined according to the first maximum unique log sequence number, the first starting unique log sequence number and the third maximum unique log sequence number as the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, wherein the third maximum unique log sequence number is the maximum unique log sequence number of the query log.
5. The method according to claim 4, characterized in that The method further comprises: The log thread corrects the unique log number of the game process log recorded by the log thread and not confirmed by the log server to have been stored in the storage resource of the log server according to the actual starting unique log number and the first starting unique log number.
6. The method according to claim 2, characterized in that The log thread performs a reconnection handshake with the log server after the initial handshake, and the method further includes: The log thread determines the smallest unique log sequence number in the memory queue of the game server; The log thread obtains a starting synchronization log sequence number determined according to the minimum unique log sequence number and the maximum unique log sequence number of the query log; The log thread starts from the starting synchronization log sequence number and transmits the corresponding game process log to the log server in real time.
7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: The transmission flow of the game process log is controlled to be lower than a preset transmission flow, wherein the preset transmission flow is a transmission flow that does not affect the transmission of the game logic control message of the game process.
8. The method according to any one of claims 1 to 6, characterized in that The method further comprises: In at least one of the following situations, the log thread stops transmitting the game process log to the log server in real time and writes the game process log to the storage resource of the game server: a write error occurs on the log server, the memory queue of the game server grows to a preset queue threshold, or the log thread is disconnected from the log server.
9. The method according to claim 8, characterized in that The method further comprises: The log thread transmits the real-time game process log and the game process log written to the disk to the log server through different channels.
10. The method according to any one of claims 1 to 6, characterized in that The log thread corresponds to the game process one by one.
11. A log processing method, characterized in that: Applied to a log server, the method comprises: Receive game process log information transmitted in real time by a log thread when a game process in a game server is running, wherein the log thread is a thread on the game server that captures logs generated by the game process, the game process log information includes a game process log, the game process log is a log generated by the game process, and the storage resources of the log server are separate from the storage resources of the game server; The received game process log is stored in the storage resource of the log server to obtain a query log; The log generated by the game process is queried based on the query log.
12. The method according to claim 11, characterized in that The game process log information also includes a unique log serial number of the game process log, and the method further includes: After storing the game process log in the storage resource of the log server, a confirmation message is sent to the log thread, wherein the confirmation message includes the unique log sequence number for indicating to the log thread that the corresponding game process log has been stored in the log server.
13. The method according to claim 11 or 12, characterized in that: The method further comprises: A separate log file is stored for each of the game processes, wherein the log file includes a log meta-information file and a log content file, wherein the log content file is used to store the log content of the game process log, and the log meta-information file is used to store the meta-information of the game process log.
14. The method according to claim 13, characterized in that The querying of the log generated by the game process based on the query log includes: Determine the corresponding log file according to the log query request; According to the log query request, based on the log meta information file in the corresponding log file, determine the game process log to be queried; The log content of the determined game process log to be queried is obtained from the log content file in the corresponding log file.
15. The method according to claim 14, characterized in that The log query request includes log queries for multiple game processes, and the method further includes: For the multiple game processes, the obtained game process logs are merged and sorted.
16. The method according to claim 12, characterized in that After the log thread is started, it shakes hands with the log server for the first time, and the method further includes: Obtaining disk log information of the disk log in the game server from the log thread, wherein the disk log is a game process log in the game process log that is stored in the storage resource of the game server during the period when the log thread stops transmitting the game process log to the log server in real time; Determine, based on the disk log information and the query log, an actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, wherein the actual starting unique log sequence number is used by the log thread to determine the starting unique log sequence number of the latest game process log generated by the game process after the log thread is started, and / or to correct the unique log sequence number of the game process log recorded by the log thread and which the log server has not confirmed to have been stored in the storage resource of the log server; The actual starting unique log sequence number is sent to the log thread.
17. The method according to claim 16, characterized in that The disk-dropped log information includes a first maximum unique log sequence number and a first starting unique log sequence number, wherein the first maximum unique log sequence number is the maximum unique log sequence number in the disk-dropped log determined by the log thread according to the disk-dropped log, the first starting unique log sequence number is the starting unique log sequence number of the latest game process log generated by the game process after the log thread is started and determined by the log thread according to the second maximum unique log sequence number, and the second maximum unique log sequence number is the maximum unique log sequence number in the game process log determined by the log thread according to the disk-dropped log and recorded by the log thread but not confirmed to have been stored in the storage resource of the log server; Then, determining the actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started according to the disk log information and the query log includes: Determine the maximum unique log sequence number of the query log to obtain a third maximum unique log sequence number; According to the first maximum unique log sequence number, the first starting unique log sequence number and the third maximum unique log sequence number, a second starting unique log sequence number is determined to obtain an actual starting unique log sequence number of the latest game process log generated by the game process after the log thread is started.
18. The method according to claim 12, characterized in that The log thread performs a reconnection handshake with the log server after the initial handshake, and the method further includes: Receive the smallest unique log sequence number in the memory queue of the game server from the log thread; Determine the maximum unique log sequence number of the query log; Determine a starting synchronization log sequence number according to the minimum unique log sequence number and the maximum unique log sequence number of the query log; The starting synchronization log sequence number is sent to the log thread, wherein the starting synchronization log sequence number is used by the log thread to determine the real-time transmission of the corresponding game process log to the log server starting from the starting synchronization log sequence number.
19. The method according to any one of claims 11 to 18, characterized in that The method further comprises: For each of the log threads, a session is maintained, and for each session, the session is executed in a coroutine manner.
20. A game server, characterized in that: Includes startup module and log process, where: The startup module is used to start the log thread, wherein the log thread is a thread for capturing logs generated by the game process in the game server; The log thread is used to capture the log generated by the game process, obtain the game process log, and transmit the game process log to the log server in real time, wherein the storage resources of the log server are separated from the storage resources of the game server and are used to store the game process log transmitted by the log thread as a query log, and the query log can be used to implement the query of the log generated by the game process.
21. A log server, characterized in that: include: A receiving module, used to receive game process log information transmitted in real time by a log thread when a game process in a game server is running, wherein the log thread is a thread on the game server that captures logs generated by the game process, the game process log information includes a game process log, the game process log is a log generated by the game process, and the storage resources of the log server are separated from the storage resources of the game server; A storage module, used to store the received game process log in the storage resource of the log server to obtain a query log; A query module is used to query the log generated by the game process based on the query log.
22. A log system, characterized in that: include: A game server, configured to execute the log processing method according to any one of claims 1 to 10; A log server, used to execute the log processing method according to any one of claims 11 to 19.
23. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processing device, the steps of the method according to any one of claims 1 to 19 are implemented.
24. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 19.
25. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 19 are implemented.