CN107943942B - Event-driven multi-turn file acquisition system - Google Patents
Event-driven multi-turn file acquisition system Download PDFInfo
- Publication number
- CN107943942B CN107943942B CN201711185042.7A CN201711185042A CN107943942B CN 107943942 B CN107943942 B CN 107943942B CN 201711185042 A CN201711185042 A CN 201711185042A CN 107943942 B CN107943942 B CN 107943942B
- Authority
- CN
- China
- Prior art keywords
- rule file
- rotation rule
- file
- scheduler
- rotation
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/1734—Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to a multi-turn file acquisition system based on event driving, which comprises a detector, a monitor, a scheduler and a thread pool which are connected in sequence; the detector is used for detecting the newly generated rotation rule file, identifying the file and then sending a registration path to the listener; the monitor is used for monitoring the registration path of the rotation rule file in real time and reacting to the scheduler after receiving the registration path; the scheduler matches the registration path sent by the listener with the rotation rule file identified by the detector, and after the matching is successful, the rotation rule file identified by the registration path is called and distributed to the thread pool; the thread pool reads the rotation rule file distributed by the scheduler, the event-driven multi-rotation file acquisition system can realize real-time acquisition, and the acquisition task is initiated based on the event, so that the consumed memory is low, and the efficiency is high.
Description
Technical Field
The invention relates to a multi-turn file acquisition system based on event driving, and belongs to the technical field of data acquisition.
Background
The method comprises the steps that log files are generated by the middleware and the service system at every moment, new files are automatically generated when the files reach a certain size or reach a set time, the log file with the earliest time is deleted when the number of the files reaches a set value, and the process is called log rotation. First, these log files usually have their own log rotation rules, and different systems have different log rotation rules. Secondly, the logs can grow in real time along with the operation of the system, and a mode for reading the growing logs in real time is needed. These complex situations and requirements all add difficulty to the collection of text data.
At present, operation and maintenance data of many systems adopt a mode of backing up generated logs to a server at a fixed time, and then starting a collector to read the fixed texts and insert the fixed texts into a distributed database (such as an HDFS). Meanwhile, the real-time flowing data volume is huge, and it is time-consuming to find out whether a new file is generated in a certain rotation file by checking each rotation file, so that the workload is huge.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: in order to overcome the problems, the event-driven multi-turn file acquisition system is provided.
The technical scheme adopted by the invention for solving the technical problems is as follows:
a multi-turn file acquisition system based on event driving comprises a detector, a monitor, a scheduler and a thread pool which are sequentially connected;
the detector is used for detecting the newly generated rotation rule file, identifying the file and then sending a registration path to the listener;
the monitor is used for monitoring the registration path of the rotation rule file in real time and reacting to the scheduler after receiving the registration path;
the scheduler matches the registration path sent by the listener with the rotation rule file identified by the detector, and after the matching is successful, the rotation rule file identified by the registration path is called and distributed to the thread pool;
and the thread pool reads the rotation rule file distributed by the scheduler.
Preferably, the listener also generates an event containing the registered path of the rotation rule file and sends the event to the scheduler.
Preferably, after traversing the rotation rule file, the detector identifies a new rotation rule file, where the new rotation rule file includes at least two of the following:
the method comprises the steps that a rotation rule file is newly generated on the basis of an existing rotation rule file, a detector firstly identifies the rotation rule file and marks the rotation rule file, a scheduler matches the rotation rule file, and the rotation rule file is distributed to a thread pool to be read after matching is successful;
the newly generated rotation rule file is an independent rotation rule file, the detector identifies and marks the rotation rule file, the scheduler matches the rotation rule file, and the rotation rule file is classified into the whole rotation rule file after matching is completed and is distributed to a corresponding thread pool for reading.
The invention has the beneficial effects that: the event-driven multi-turn file acquisition system can realize real-time acquisition, the acquisition task is initiated based on the event, the consumed memory is low, the efficiency is high, and the system can simultaneously acquire a large number of turn rule files without overhigh load.
Drawings
The invention is further illustrated with reference to the following figures and examples.
FIG. 1 is a block diagram of the architecture of one embodiment of the present invention.
Detailed Description
The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic views illustrating only the basic structure of the present invention in a schematic manner, and thus show only the constitution related to the present invention.
Example 1
The event-driven multi-turn file acquisition system comprises a detector, a monitor, a scheduler and a thread pool which are sequentially connected, and the event-driven multi-turn file acquisition system not only comprises the modules, but also can be configured with other modules if needed;
the detector is used for detecting a newly generated rotation rule file, identifying the rotation rule file and sending out a registration path of the rotation rule file;
the monitor is used for monitoring the registration path of the rotating file in real time and reacting the registration path to the scheduler;
the scheduler matches the file path detected by the listener with the file identified by the detector, and after the matching is successful, the round robin rule file is called and distributed to the thread pool;
and the thread pool reads the rotation rule file distributed by the scheduler.
The event-driven multi-turn file acquisition system can realize real-time acquisition by adopting the detector, the acquisition task is initiated in the monitor based on the event, the consumed memory is low, the efficiency is high, and the task is more efficient by being distributed to a specific thread pool through the scheduler.
In a preferred embodiment, the listener generates an event containing a round robin file path and sends the event to the scheduler.
In a preferred embodiment, after the detector traverses the rotation rule file, that is, the detector accesses each rotation rule file once, the structure is not limited to the tree structure, and a new file is identified. The identified files are two in number;
the first is a file newly generated on the basis of the existing rotating file, firstly, a detector identifies the file and identifies the file, a scheduler matches the file, and the file is distributed to a thread pool to be read after the matching is successful;
and the second method is that the newly generated file is an independent rotating file, the detector identifies and marks the file, the scheduler matches the file, and the file is classified into the whole rotating file after matching is finished and is distributed to a corresponding thread pool for reading.
In a preferred embodiment, the event type is a preferred event type in the art, but is not limited to the two types, and other types of events can be selected according to needs.
Example 2
The embodiment provides a specific operation implementation mode on the basis of the embodiment 1, for example, a page configuration reads a round robin rule file/var/log/maillog, the scheduler only needs to encapsulate the path change into a read unit and register a directory part (/ var/log) of the path change to the listener, the listener informs the scheduler of the path (/ var/log/maillog) of the file and the event type after detecting the file change, the scheduler matches the path to find the read unit and encapsulates the read unit into a Task to be sent to a thread pool, and the thread pool can use one thread to perform final file reading.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
In light of the foregoing description of the preferred embodiment of the present invention, many modifications and variations will be apparent to those skilled in the art without departing from the spirit and scope of the invention. The technical scope of the present invention is not limited to the content of the specification, and must be determined according to the scope of the claims.
Claims (2)
1. A multi-turn file acquisition system based on event driving is characterized by comprising a detector, a monitor, a scheduler and a thread pool which are sequentially connected;
the detector is used for detecting the newly generated rotation rule file, identifying the file and then sending a registration path to the listener;
the monitor is used for monitoring the registration path of the rotation rule file in real time and reacting to the scheduler after receiving the registration path;
the scheduler matches the registration path sent by the listener with the rotation rule file identified by the detector, and after the matching is successful, the rotation rule file identified by the registration path is called and distributed to the thread pool;
the thread pool reads a rotation rule file distributed by the scheduler;
after traversing the rotation rule file, the detector identifies a new rotation rule file, wherein the new rotation rule file at least comprises the following two types:
the method comprises the steps that a rotation rule file is newly generated on the basis of an existing rotation rule file, a detector firstly identifies the rotation rule file and marks the rotation rule file, a scheduler matches the rotation rule file, and the rotation rule file is distributed to a thread pool to be read after matching is successful;
the newly generated rotation rule file is an independent rotation rule file, the detector identifies and marks the rotation rule file, the scheduler matches the rotation rule file, and the rotation rule file is classified into the whole rotation rule file after matching is completed and is distributed to a corresponding thread pool for reading.
2. The event-driven-based multi-turn file collection system of claim 1, wherein the listener further generates an event containing a registered path of the turn rule file and sends the event to the scheduler.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711185042.7A CN107943942B (en) | 2017-11-23 | 2017-11-23 | Event-driven multi-turn file acquisition system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711185042.7A CN107943942B (en) | 2017-11-23 | 2017-11-23 | Event-driven multi-turn file acquisition system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107943942A CN107943942A (en) | 2018-04-20 |
CN107943942B true CN107943942B (en) | 2020-08-28 |
Family
ID=61930209
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711185042.7A Active CN107943942B (en) | 2017-11-23 | 2017-11-23 | Event-driven multi-turn file acquisition system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107943942B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104618343A (en) * | 2015-01-06 | 2015-05-13 | 中国科学院信息工程研究所 | Method and system for detecting website threat based on real-time log |
CN104750811A (en) * | 2015-03-30 | 2015-07-01 | 浪潮通信信息系统有限公司 | Multithreading real-time acquisition method for mobile communication data file |
CN106028373A (en) * | 2016-05-05 | 2016-10-12 | 上海和辰信息技术有限公司 | Cloud service data feature-based mobile internet data exchange system and method |
CN106991177A (en) * | 2017-04-06 | 2017-07-28 | 广东亿迅科技有限公司 | The nondestructive collection method and its system of real-time logs under a kind of distributed environment |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6856910B2 (en) * | 2003-01-09 | 2005-02-15 | Schlumberger Technology Corporation | Method and apparatus for determining regional dip properties |
-
2017
- 2017-11-23 CN CN201711185042.7A patent/CN107943942B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104618343A (en) * | 2015-01-06 | 2015-05-13 | 中国科学院信息工程研究所 | Method and system for detecting website threat based on real-time log |
CN104750811A (en) * | 2015-03-30 | 2015-07-01 | 浪潮通信信息系统有限公司 | Multithreading real-time acquisition method for mobile communication data file |
CN106028373A (en) * | 2016-05-05 | 2016-10-12 | 上海和辰信息技术有限公司 | Cloud service data feature-based mobile internet data exchange system and method |
CN106991177A (en) * | 2017-04-06 | 2017-07-28 | 广东亿迅科技有限公司 | The nondestructive collection method and its system of real-time logs under a kind of distributed environment |
Non-Patent Citations (1)
Title |
---|
基于LabVIEW事件驱动的数据采集;安军等;《仪表技术与传感器》;20071130;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN107943942A (en) | 2018-04-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109684352B (en) | Data analysis system, data analysis method, storage medium, and electronic device | |
CN107506451B (en) | Abnormal information monitoring method and device for data interaction | |
CN101719149B (en) | Data synchronization method and device | |
CN104537076B (en) | A kind of file read/write method and device | |
CN108694195B (en) | Management method and system of distributed data warehouse | |
CN105224445A (en) | Distributed tracking system | |
CN103793479A (en) | Log management method and log management system | |
CN103502949A (en) | Fault sensing system for sensing fault in plurality of control systems | |
CN105068920A (en) | Shell-based method for testing stability of rack asset information | |
CN102915269A (en) | Method for analyzing common logs of B/S (browser/server) software system | |
CN105302730A (en) | Calculation model detection method, testing server and service platform | |
CN107729375B (en) | Log data sorting method and device | |
CN107704362A (en) | A kind of method and device based on Ambari monitoring big data components | |
CN110134646B (en) | Knowledge platform service data storage and integration method and system | |
US8539492B1 (en) | Managing data dependencies among multiple jobs using separate tables that store job results and dependency satisfaction | |
US9092338B1 (en) | Multi-level caching event lookup | |
CN107943942B (en) | Event-driven multi-turn file acquisition system | |
CN102855297B (en) | A kind of method of control data transmission and connector | |
CN112433888A (en) | Data processing method and device, storage medium and electronic equipment | |
CN116166750A (en) | Database synchronization system and method based on Kafka | |
CN114238018B (en) | Method, system and device for detecting integrity of log collection file and storage medium | |
CN115757045A (en) | Transaction log analysis method, system and device | |
CN115309334A (en) | Disk management method, device, equipment and storage medium | |
CN111291127B (en) | Data synchronization method, device, server and storage medium | |
CN114547206A (en) | Data synchronization method and data synchronization system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20230427 Address after: Rooms 601-604, 6th Floor, Building 4, No. 1 Lanxiangou, Haidian District, Beijing, 100089 Patentee after: BEIJING ADVANCED DIGITAL TECHNOLOGY Co.,Ltd. Address before: 215000, floor 6, building 2, complex building, No. 18, Kechuang Road, science and Technology City, high tech Zone, Suzhou, Jiangsu Province Patentee before: SUZHOU YOSEMEI INTELLIGENT SYSTEM CO.,LTD. |
|
TR01 | Transfer of patent right |