Method and system for collecting data in log file
A log file and data collection technology, applied in the field of big data processing, can solve problems such as spooldir does not support breakpoint resume, file content is immutable, and timeliness is poor
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Publication Date
- 2016-12-21
- Estimated Expiration
- Not applicable · inactive patent
Smart Images
Figure 1
Abstract
Description
technical field
[0001] The invention relates to the technical field of big data processing, in particular to a method for collecting data in log files and a system for collecting data in log files. Background technique
[0002] Flume (Flume is a highly available, highly reliable, and distributed massive log collection, aggregation, and transmission system provided by Cloudera. Flume supports customizing various data senders in the log system for data collection; at the same time, Flume Provides the ability to simply process data and write to various data recipients (customizable).) Two source sources are provided: ExecSource executes the system command tail-F; the other is spooldir. The system can support real-time collection of data in log files to a certain extent. But there are certain problems.
[0003] When ExecSource executes the system command tail–F to collect data in log files in real time, the problems are as follows:
[0004] Question 1: If the agent process of...
Examples
Embodiment Construction
[0020] like figure 1 As shown, the data collection method in this log file includes the following steps:
[0021] (1) Regularly check the information of the log files under the log directory, the information includes: log file name, log file length, inode value of the log file;
[0022] Explain why the inode value is taken: Since the name will change when the log is rolled, in order to still find the file, you need to find a unique identifier; when the file in the same physical disk is rename or mv, its inode value remains unchanged; Log rolling is equivalent to doing rename or mv operations; for example: for example, the inode of app.log=5914332, when the log is rolling, the inode of the generated log file app.log.20160422 is still 5914332, and the inode of the new app.log file is New value, for example: 5914335;
[0023] (2) Real-time collection: collect logs, the consumption offset of the newly generated file is 0, and record the inode value and consumption offset of the ...