Exemplo n.º 1
0
        protected List <IngestEvent> ConvertEventsToIngestEvents(List <EventValue> events)
        {
            List <IngestEvent> eventList = new List <IngestEvent>();

            foreach (EventValue value in events)
            {
                // Format title and message
                string message = value.Message;
                string title   = value.Title;
                if (title.Length > _maxEventTitleLength)
                {
                    title = title.Substring(0, _maxEventTitleLength);
                }

                //Convert level to netuitive compatible levels
                string level = "";
                switch (value.Level)
                {
                case "CRITICAL":
                case "ERROR":
                    level = "CRITICAL";
                    break;

                case "WARNING":
                    level = "WARNING";
                    break;

                case "INFO":
                case "DEBUG":
                default:
                    level = "INFO";
                    break;
                }

                IngestEvent ie = new IngestEvent("INFO", "", title, value.Timestamp * 1000);

                IngestEventData data = new IngestEventData(value.HostName, level, message);
                ie.setData(data);
                //TODO - tags

                eventList.Add(ie);
            }

            return(eventList);
        }
        protected List <IngestEvent> ExtractEventsFromCollectables(Queue <CollectableValue> values)
        {
            List <IngestEvent> events = values.OfType <EventValue>()
                                        .Select(value =>
            {
                // Format title and message
                string message = value.Message;
                string title   = value.Title;
                if (title.Length > _maxEventTitleLength)
                {
                    title = title.Substring(0, _maxEventTitleLength);
                }

                //Convert level to netuitive compatible levels
                string level = "";
                switch (value.Level)
                {
                case "CRITICAL":
                case "ERROR":
                    level = "CRITICAL";
                    break;

                case "WARNING":
                case "WARN":
                    level = "WARNING";
                    break;

                case "INFO":
                case "DEBUG":
                default:
                    level = "INFO";
                    break;
                }

                IngestEvent ie = new IngestEvent("INFO", value.Source, title, value.Timestamp * 1000);

                IngestEventData data = new IngestEventData(value.HostName, level, message);
                ie.setData(data);

                return(ie);
            }).ToList();

            return(events);
        }
Exemplo n.º 3
0
        protected List<IngestEvent> ConvertEventsToIngestEvents(List<EventValue> events)
        {
            List<IngestEvent> eventList = new List<IngestEvent>();
            foreach (EventValue value in events)
            {

                // Format title and message
                string message = value.Message;
                string title = value.Title;
                if (title.Length > _maxEventTitleLength)
                    title = title.Substring(0, _maxEventTitleLength);

                //Convert level to netuitive compatible levels
                string level = "";
                switch (value.Level)
                {
                    case "CRITICAL":
                    case "ERROR":
                        level = "CRITICAL";
                        break;
                    case "WARNING":
                        level = "WARNING";
                        break;
                    case "INFO":
                    case "DEBUG":
                    default:
                        level = "INFO";
                        break;
                }

                IngestEvent ie = new IngestEvent("INFO", "", title, value.Timestamp * 1000);

                IngestEventData data = new IngestEventData(value.HostName, level, message);
                ie.setData(data);
                //TODO - tags

                eventList.Add(ie);
            }

            return eventList;
        }