The invention relates to a log mode extraction and matching method, which comprises the following steps of S1, cleaning historical log data to obtain cleaned historical log data; S2, preprocessing thecleaned historical log data to obtain preprocessed historical log data; S3, obtaining a historical word vector based on the preprocessed historical log data; S4, inputting the historical word vectorsinto a twin LSTM network, and extracting a log mode; and S5, based on the to-be-matched log data, the log mode and the twin LSTM network, performing log mode matching of the to-be-matched log data. Compared with the prior art, the data volume of log analysis is reduced, the log pattern extraction efficiency is improved, the log pattern matching efficiency is improved, and the reliability of a logpattern extraction result and the reliability of a log pattern matching result are effectively improved.