The invention relates to a log
processing method based on dynamic triggering and index driving, and relates to the technical field of
computer software, and the method comprises the following steps: coding log entries through a dictionary coding rule, generating coded log entries, and writing the coded log entries into a
plaintext log file; monitoring a file state of the
plaintext log file, and when the file state meets a preset dynamic triggering condition, compressing the
plaintext log file to generate a compressed log file; generating an index file associated with the compressed log file, wherein the index file comprises
metadata; and in response to a user query request, positioning and compressing a target data block in the log file based on the
metadata, decompressing and reversely decoding the target data block, and filtering decoded log contents according to the query mode to output a log query result. By means of the scheme, development complexity is reduced, efficient real-
time compression is achieved, full scanning is avoided, consumed time in the index positioning stage is reduced from the minute level to the
millisecond level, and query efficiency is improved.