getAuditManager().addAuditProfileType alternative for 8.3

In a 8.1 module, we use this to create a custom audit profile type:

this.context = gatewayContext;
type = new AuditLogSplitterType();
this.context.getAuditManager().addAuditProfileType(type);

I don’t find any equivalent in 8.3 sdk ?

com.inductiveautomation.ignition.gateway.audit.AuditProfileType::createProfile

seems to be the solution for the create logic,

but I don’t find how to register the new AuditProfileType ???

1 Like

Implement GatewayModuleHook::getExtensionPoints, and return your implementation of AuditProfileType with any others, if applicable.

When I try to create my audit profil type, I have an error in the gateway UI but no error log in the gateway logger.
I probably miss something.
For other extension Point (device or slack alarm notification exemple), the settings record is provided to the constructor ?

I've tried to add in the GatewayHook::setup something like:

this.context.getConfigurationManager().getResourceTypeMetaRegistry().register(AuditLogSplitterSettingsResource.META);

I added in the gatewayHook:

    @Override
    public List<? extends ExtensionPoint<AuditLogSplitterSettingsResource>> getExtensionPoints(){
        try {
            logger.info("getExtensionPoints()");
            type = new AuditLogSplitterType();
            return (List<? extends ExtensionPoint<AuditLogSplitterSettingsResource>>) List.of(type);
        } catch (Exception e) {
            logger.error("getExtensionPoints() : ",e);
            return List.of();
        }
    }    

Record AuditLogSplitterSettingsResource

public record AuditLogSplitterSettingsResource(
@FormReferenceType("com.inductiveautomation.opcua.drivers.bacnet/BacnetIpLocalDeviceConfig")
        @FormCategory("Audit settings")
        @FormField(FormFieldType.TEXT)
        @Label("TableName")
        @Required
        @DefaultValue("")
        @Description("")
        String tableName
)
{}
public class AuditLogSplitterType extends AuditProfileType<AuditLogSplitterSettingsResource> {

	private Logger logger = LoggerFactory.getLogger(getClass());
    public static final String TYPE_ID = "AuditLogSplitter";

	public AuditLogSplitterType() {
        super(TYPE_ID,"AuditLogSplitter","Audit Log Splitter BYES");
		//super(TYPE_ID, "AuditLogSplitter.Name", "AuditLogSplitter.Desc");
	}


    @Override
    public AuditProfile createProfile(GatewayContext gatewayContext, String name, AuditProfileConfig auditProfileConfig, Optional<AuditLogSplitterSettingsResource> optional) throws Exception {
        logger.info("createProfile() : {}",name);
        AuditLogSplitter audit = new AuditLogSplitter(gatewayContext,name);
        return audit;
    }

    @Override
    public Optional<WebUiComponent> getWebUiComponent(ComponentType type) {
        return Optional.of(
                new ExtensionPointResourceForm(
                        AuditProfileType.RESOURCE_TYPE,
                        "AuditLogSplitterType",
                        TYPE_ID,
                        SchemaUtil.fromType(AuditProfileConfig.class),
                        SchemaUtil.fromType(AuditLogSplitterSettingsResource.class),
                        Set.of()));
    }
}

I think I found the solution by adding in AuditLogSplitterType

    @Override
    public Optional<Class<AuditLogSplitterSettingsResource>> settingsType() {
        return Optional.of(AuditLogSplitterSettingsResource.class);
    }