simonbence commented on a change in pull request #5530:
URL: https://github.com/apache/nifi/pull/5530#discussion_r792576830



##########
File path: 
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/cef/CEFSchemaUtil.java
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.cef;
+
+import org.apache.nifi.serialization.record.DataType;
+import org.apache.nifi.serialization.record.RecordField;
+import org.apache.nifi.serialization.record.RecordFieldType;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+final class CEFSchemaUtil {
+
+    private static final List<RecordField> HEADER_FIELDS = new ArrayList<>();
+
+    static {
+        // Reference states that severity might be represented by integer 
values (0-10) and string values (like High) too
+        HEADER_FIELDS.add(new RecordField("version", 
RecordFieldType.INT.getDataType()));
+        HEADER_FIELDS.add(new RecordField("deviceVendor", 
RecordFieldType.STRING.getDataType()));
+        HEADER_FIELDS.add(new RecordField("deviceProduct", 
RecordFieldType.STRING.getDataType()));
+        HEADER_FIELDS.add(new RecordField("deviceVersion", 
RecordFieldType.STRING.getDataType()));
+        HEADER_FIELDS.add(new RecordField("deviceEventClassId", 
RecordFieldType.STRING.getDataType()));
+        HEADER_FIELDS.add(new RecordField("name", 
RecordFieldType.STRING.getDataType()));
+        HEADER_FIELDS.add(new RecordField("severity", 
RecordFieldType.STRING.getDataType()));
+    }
+
+    // Fields known by the CEF Extension Dictionary in version 23
+    private static final Set<String> EXTENSIONS_STRING = new 
HashSet<>(Arrays.asList("act", "app", "c6a1Label", "c6a2Label", "c6a3Label",

Review comment:
       The order is deliberate: it follows the list of possible extensions in 
the CEF Extension Dictionary. Because of the expectations of the CEF format 
(agains date types as well), falling back to String does not seems to be a good 
idea here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to