Example #1
0
        public void PrepareEvent(Dictionary<string, object> logEvent)
        {
            object token;
            string key = _key.Format(logEvent);
            if (logEvent.TryGetValue(key, out token))
            {
                logEvent.Remove(key);

                var newName = _renameTo.Format(logEvent);

                if (!Overwrite && logEvent.ContainsKey(newName))
                {
                    logEvent.AddTag(FailedToRename);
                    return;
                }

                logEvent[newName] = token;
            }
        }
Example #2
0
        protected void ScanMessage(Dictionary<string, object> logEvent, string input)
        {
            var match = _regex.Match(input);
            
            if (!match.Success)
            {
                logEvent.AddTag(FailedGrok);
            }

            foreach (var groupName in _groupNames)
            {
                var key = match.Groups[groupName];
                if (!key.Success) continue;

                if (Overwrite)
                {
                    logEvent[groupName] = key.Value;
                }
                else
                {
                    logEvent.AddOrSet(groupName, key.Value);
                }
            }
        }