in log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/catalog/CatalogManagerImpl.java [158:200]
protected void addEntry(Map<String, Map<String, CatalogInfo>> map, Event event) {
CatalogInfo info = new CatalogInfo();
info.event = event;
String catalogId = event.getCatalogId();
if (catalogId != null && catalogId.length() > 0 && !map.containsKey(catalogId)) {
map.put(catalogId, new HashMap<>());
}
List<String> required = new ArrayList<>();
List<String> names = new ArrayList<>();
info.attributes = new HashMap<>(names.size());
if (event.getAttributes() != null) {
for (EventAttribute eventAttribute : event.getAttributes()) {
String name = eventAttribute.getName();
Attribute attribute = getAttribute(name, event.getCatalogId());
if (attribute != null) {
info.attributes.put(name, attribute);
if (name.indexOf('.') != -1) {
name = name.replaceAll("\\.", "");
}
if (name.indexOf('/') != -1) {
name = name.replaceAll("/", "");
}
if (attribute.isRequestContext()) {
if (attribute.isRequired()) {
if (name.startsWith(REQCTX)) {
name = name.substring(REQCTX.length());
}
required.add(name);
}
} else {
names.add(name);
}
} else {
throw new IllegalStateException("Attribute " + name + " is not defined");
}
}
}
info.requiredContextAttributes = required;
info.attributeNames = names;
Map<String, CatalogInfo> catalogMap = catalogId == null ?
map.get(DEFAULT_CATALOG) : map.get(catalogId);
catalogMap.put(NamingUtils.getFieldName(event.getName()), info);
}