public static GrokParseFilter <TAccumluator> Create(string pattern) { var resolver = new RegexPatternResolver(HardcodedPatterns.Patterns); var filter = new GrokParseFilter <TAccumluator>(resolver, pattern); return(filter); }
public void RegexMatchesCorrectly() { // Arrange var patterns = HardcodedPatterns.Patterns; var resolver = new RegexPatternResolver(patterns); var message = "testUser INFO 192.168.0.1 Internal Server Error"; var grok = "%{USERNAME:user} %{WORD:loglevel} %{IPV4:ip} %{GREEDYDATA:error}"; // Act var output = resolver.Reslove(message, grok); // Assert Assert.AreEqual("testUser", output["user"]); Assert.AreEqual("INFO", output["loglevel"]); Assert.AreEqual("192.168.0.1", output["ip"]); Assert.AreEqual("Internal Server Error", output["error"]); }
public GrokParseFilter(RegexPatternResolver regexResolver, string pattern) { RegexResolver = regexResolver; Pattern = pattern; }