You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ho...@apache.org on 2026/10/22 12:38:26 UTC

(streampipes) branch 5111-add-datasets-to-audit-log updated (c4fd926352 -> ff4c30c72c)

This is an automated email from the ASF dual-hosted git repository.

JHoelli pushed a change to branch 5111-add-datasets-to-audit-log
in repository https://gitbox.apache.org/repos/asf/streampipes.git


    from c4fd926352 feat: Let UI check for updates and show update notification (#5096)
     new c766081825 standard
     new 49a230c008 feat(#5111): audit dataset data operations
     new ff4c30c72c make ui work

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../audit/events/StandardAuditEvents.java          | 34 +++++++++
 .../audit/events/dataset/DatasetAuditReporter.java | 84 ++++++++++++++++++++++
 .../DatasetCreatedDetails.java}                    |  5 +-
 .../DatasetDataClearedDetails.java}                |  5 +-
 .../DatasetDataDeletedDetails.java}                |  5 +-
 .../DatasetDataTruncatedDetails.java}              |  5 +-
 .../DatasetDeletedDetails.java}                    |  5 +-
 .../DatasetDroppedDetails.java}                    |  5 +-
 .../DatasetEditedDetails.java}                     |  5 +-
 .../DatasetRetentionConfiguredDetails.java}        |  5 +-
 .../DatasetRetentionRemovedDetails.java}           |  5 +-
 .../DatasetRetentionRunDetails.java}               |  5 +-
 .../events/dataset/DatasetAuditReporterTest.java   | 74 +++++++++++++++++++
 .../rest/impl/dataset/DatasetMetadataResource.java | 12 ++++
 .../rest/impl/dataset/DatasetResource.java         | 21 ++++++
 ui/deployment/feature-cards.yml                    |  4 ++
 .../audit-log/audit-log.component.spec.ts          | 15 ++++
 .../dataset-overview.component.html                |  2 +-
 18 files changed, 275 insertions(+), 21 deletions(-)
 create mode 100644 streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetAuditReporter.java
 copy streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/{adapter/AdapterLifecycleDetails.java => dataset/DatasetCreatedDetails.java} (80%)
 copy streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/{adapter/AdapterLifecycleDetails.java => dataset/DatasetDataClearedDetails.java} (80%)
 copy streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/{adapter/AdapterLifecycleDetails.java => dataset/DatasetDataDeletedDetails.java} (78%)
 copy streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/{adapter/AdapterLifecycleDetails.java => dataset/DatasetDataTruncatedDetails.java} (80%)
 copy streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/{adapter/AdapterLifecycleDetails.java => dataset/DatasetDeletedDetails.java} (81%)
 copy streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/{adapter/AdapterLifecycleDetails.java => dataset/DatasetDroppedDetails.java} (82%)
 copy streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/{adapter/AdapterLifecycleDetails.java => dataset/DatasetEditedDetails.java} (80%)
 copy streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/{adapter/AdapterLifecycleDetails.java => dataset/DatasetRetentionConfiguredDetails.java} (79%)
 copy streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/{adapter/AdapterLifecycleDetails.java => dataset/DatasetRetentionRemovedDetails.java} (82%)
 copy streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/{adapter/AdapterLifecycleDetails.java => dataset/DatasetRetentionRunDetails.java} (82%)
 create mode 100644 streampipes-audit-events/src/test/java/org/apache/streampipes/audit/events/dataset/DatasetAuditReporterTest.java


(streampipes) 03/03: make ui work

Posted by ho...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

JHoelli pushed a commit to branch 5111-add-datasets-to-audit-log
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit ff4c30c72c1f38473a638c0e03b74e22e811f3ef
Author: Jacqueline Höllig <j....@gmx.net>
AuthorDate: Thu Oct 22 14:37:44 2026 +0200

    make ui work
---
 ui/deployment/feature-cards.yml                           |  4 ++++
 .../configuration/audit-log/audit-log.component.spec.ts   | 15 +++++++++++++++
 .../dataset-overview/dataset-overview.component.html      |  2 +-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/ui/deployment/feature-cards.yml b/ui/deployment/feature-cards.yml
index 8265f5adff..6f32c8d42a 100644
--- a/ui/deployment/feature-cards.yml
+++ b/ui/deployment/feature-cards.yml
@@ -25,6 +25,10 @@
   componentPath: './dashboard/components/dashboard-feature-card/dashboard-feature-card.component'
   componentName: DashboardFeatureCardComponent
   moduleName: spDashboard
+- id: dataset
+  componentPath: './dataset/components/dataset-feature-card/dataset-feature-card.component'
+  componentName: DatasetFeatureCardComponent
+  moduleName: spDatasets
 - id: measurement
   componentPath: './dataset/components/dataset-feature-card/dataset-feature-card.component'
   componentName: DatasetFeatureCardComponent
diff --git a/ui/src/app/configuration/audit-log/audit-log.component.spec.ts b/ui/src/app/configuration/audit-log/audit-log.component.spec.ts
index 42d5914a7c..9820c0c902 100644
--- a/ui/src/app/configuration/audit-log/audit-log.component.spec.ts
+++ b/ui/src/app/configuration/audit-log/audit-log.component.spec.ts
@@ -140,6 +140,21 @@ describe('AuditLogComponent', () => {
         expect(dialogs.open).not.toHaveBeenCalled();
     });
 
+    it('opens the dataset card from the audit preview', () => {
+        cards.supportsFeatureCard.mockImplementation(
+            type => type === 'adapter' || type === 'dataset',
+        );
+        const click = new Event('click');
+        component.openResourcePreview(
+            { ...event, resourceType: 'dataset', resourceId: 'dataset-1' },
+            click,
+        );
+        expect(cards.openFeatureCard).toHaveBeenCalledWith(
+            'dataset',
+            'dataset-1',
+        );
+    });
+
     it('keeps time bounds stable across pages and resets cursors when filters change', () => {
         component.ngOnInit();
         const first = api.getEvents.mock.calls[0][0];
diff --git a/ui/src/app/dataset/components/dataset-overview/dataset-overview.component.html b/ui/src/app/dataset/components/dataset-overview/dataset-overview.component.html
index f8b2d13373..42c64feddf 100644
--- a/ui/src/app/dataset/components/dataset-overview/dataset-overview.component.html
+++ b/ui/src/app/dataset/components/dataset-overview/dataset-overview.component.html
@@ -53,7 +53,7 @@
     <div fxLayout="column" fxLayoutAlign="start start">
         <div fxLayout="column" class="w-100" fxLayoutGap="10px">
             <sp-table
-                featureCardId="measurement"
+                featureCardId="dataset"
                 [dataSource]="dataSource"
                 [columns]="displayedColumns"
                 resourceIdKey="elementId"


(streampipes) 02/03: feat(#5111): audit dataset data operations

Posted by ho...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

JHoelli pushed a commit to branch 5111-add-datasets-to-audit-log
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 49a230c0088de35080a6e5b416d506deec8b29b6
Author: Jacqueline Höllig <j....@gmx.net>
AuthorDate: Thu Oct 22 13:41:03 2026 +0200

    feat(#5111): audit dataset data operations
---
 .../audit/events/StandardAuditEvents.java          | 23 ++++++++++++++
 .../audit/events/dataset/DatasetAuditReporter.java | 35 ++++++++++++++++++++++
 .../events/dataset/DatasetDataClearedDetails.java  | 25 ++++++++++++++++
 .../events/dataset/DatasetDataDeletedDetails.java  | 25 ++++++++++++++++
 .../dataset/DatasetDataTruncatedDetails.java       | 25 ++++++++++++++++
 .../events/dataset/DatasetDroppedDetails.java      | 25 ++++++++++++++++
 .../dataset/DatasetRetentionConfiguredDetails.java | 25 ++++++++++++++++
 .../dataset/DatasetRetentionRemovedDetails.java    | 25 ++++++++++++++++
 .../events/dataset/DatasetRetentionRunDetails.java | 25 ++++++++++++++++
 .../rest/impl/dataset/DatasetResource.java         | 21 +++++++++++++
 10 files changed, 254 insertions(+)

diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/StandardAuditEvents.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/StandardAuditEvents.java
index 931c1639b0..7a3ab120fa 100644
--- a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/StandardAuditEvents.java
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/StandardAuditEvents.java
@@ -25,8 +25,15 @@ import org.apache.streampipes.audit.events.adapter.AdapterEditedDetails;
 import org.apache.streampipes.audit.events.adapter.AdapterLifecycleDetails;
 import org.apache.streampipes.audit.events.authentication.AuthenticationDetails;
 import org.apache.streampipes.audit.events.dataset.DatasetCreatedDetails;
+import org.apache.streampipes.audit.events.dataset.DatasetDataClearedDetails;
+import org.apache.streampipes.audit.events.dataset.DatasetDataDeletedDetails;
+import org.apache.streampipes.audit.events.dataset.DatasetDataTruncatedDetails;
 import org.apache.streampipes.audit.events.dataset.DatasetDeletedDetails;
+import org.apache.streampipes.audit.events.dataset.DatasetDroppedDetails;
 import org.apache.streampipes.audit.events.dataset.DatasetEditedDetails;
+import org.apache.streampipes.audit.events.dataset.DatasetRetentionConfiguredDetails;
+import org.apache.streampipes.audit.events.dataset.DatasetRetentionRemovedDetails;
+import org.apache.streampipes.audit.events.dataset.DatasetRetentionRunDetails;
 
 import java.util.List;
 
@@ -38,6 +45,20 @@ public final class StandardAuditEvents implements AuditEventProvider {
       new AuditEventDefinition<>("sp.dataset.edit", DatasetEditedDetails.class, "dataset");
   public static final AuditEventDefinition<DatasetDeletedDetails> DATASET_DELETE =
       new AuditEventDefinition<>("sp.dataset.delete", DatasetDeletedDetails.class, "dataset");
+  public static final AuditEventDefinition<DatasetDataDeletedDetails> DATASET_DATA_DELETE =
+      new AuditEventDefinition<>("sp.dataset.data.delete", DatasetDataDeletedDetails.class, "dataset");
+  public static final AuditEventDefinition<DatasetDataTruncatedDetails> DATASET_DATA_TRUNCATE =
+      new AuditEventDefinition<>("sp.dataset.data.truncate", DatasetDataTruncatedDetails.class, "dataset");
+  public static final AuditEventDefinition<DatasetDroppedDetails> DATASET_DROP =
+      new AuditEventDefinition<>("sp.dataset.drop", DatasetDroppedDetails.class, "dataset");
+  public static final AuditEventDefinition<DatasetDataClearedDetails> DATASET_DATA_CLEAR =
+      new AuditEventDefinition<>("sp.dataset.data.clear", DatasetDataClearedDetails.class, "dataset");
+  public static final AuditEventDefinition<DatasetRetentionConfiguredDetails> DATASET_RETENTION_CONFIGURE =
+      new AuditEventDefinition<>("sp.dataset.retention.configure", DatasetRetentionConfiguredDetails.class, "dataset");
+  public static final AuditEventDefinition<DatasetRetentionRemovedDetails> DATASET_RETENTION_REMOVE =
+      new AuditEventDefinition<>("sp.dataset.retention.remove", DatasetRetentionRemovedDetails.class, "dataset");
+  public static final AuditEventDefinition<DatasetRetentionRunDetails> DATASET_RETENTION_RUN =
+      new AuditEventDefinition<>("sp.dataset.retention.run", DatasetRetentionRunDetails.class, "dataset");
 
   public static final AuditEventDefinition<AdapterCreatedDetails> ADAPTER_CREATE =
       new AuditEventDefinition<>("sp.adapter.create", AdapterCreatedDetails.class, "adapter");
@@ -56,6 +77,8 @@ public final class StandardAuditEvents implements AuditEventProvider {
 
   private static final List<AuditEventDefinition<?>> EVENT_TYPES = List.of(
       DATASET_CREATE, DATASET_EDIT, DATASET_DELETE,
+      DATASET_DATA_DELETE, DATASET_DATA_TRUNCATE, DATASET_DROP, DATASET_DATA_CLEAR,
+      DATASET_RETENTION_CONFIGURE, DATASET_RETENTION_REMOVE, DATASET_RETENTION_RUN,
       ADAPTER_CREATE, ADAPTER_START, ADAPTER_STOP, ADAPTER_EDIT, AUTH_LOGIN, AUTH_LOGOUT);
 
   @Override
diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetAuditReporter.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetAuditReporter.java
index 73703e8b18..c3c7536f37 100644
--- a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetAuditReporter.java
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetAuditReporter.java
@@ -46,4 +46,39 @@ public final class DatasetAuditReporter {
     auditService.record(StandardAuditEvents.DATASET_DELETE, AuditOutcome.SUCCEEDED, actor, datasetId,
         new DatasetDeletedDetails());
   }
+
+  public void dataDeleted(String actor, String datasetId, Long startDate, Long endDate) {
+    auditService.record(StandardAuditEvents.DATASET_DATA_DELETE, AuditOutcome.SUCCEEDED, actor, datasetId,
+        new DatasetDataDeletedDetails(startDate, endDate));
+  }
+
+  public void dataTruncated(String actor, String datasetId) {
+    auditService.record(StandardAuditEvents.DATASET_DATA_TRUNCATE, AuditOutcome.SUCCEEDED, actor, datasetId,
+        new DatasetDataTruncatedDetails());
+  }
+
+  public void dropped(String actor, String datasetId) {
+    auditService.record(StandardAuditEvents.DATASET_DROP, AuditOutcome.SUCCEEDED, actor, datasetId,
+        new DatasetDroppedDetails());
+  }
+
+  public void allDataCleared(String actor) {
+    auditService.record(StandardAuditEvents.DATASET_DATA_CLEAR, AuditOutcome.SUCCEEDED, actor, null,
+        new DatasetDataClearedDetails());
+  }
+
+  public void retentionConfigured(String actor, String datasetId) {
+    auditService.record(StandardAuditEvents.DATASET_RETENTION_CONFIGURE, AuditOutcome.SUCCEEDED, actor, datasetId,
+        new DatasetRetentionConfiguredDetails());
+  }
+
+  public void retentionRemoved(String actor, String datasetId) {
+    auditService.record(StandardAuditEvents.DATASET_RETENTION_REMOVE, AuditOutcome.SUCCEEDED, actor, datasetId,
+        new DatasetRetentionRemovedDetails());
+  }
+
+  public void retentionRun(String actor, String datasetId) {
+    auditService.record(StandardAuditEvents.DATASET_RETENTION_RUN, AuditOutcome.SUCCEEDED, actor, datasetId,
+        new DatasetRetentionRunDetails());
+  }
 }
diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDataClearedDetails.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDataClearedDetails.java
new file mode 100644
index 0000000000..cf05e1b1b5
--- /dev/null
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDataClearedDetails.java
@@ -0,0 +1,25 @@
+/*
+ * 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.streampipes.audit.events.dataset;
+
+import org.apache.streampipes.audit.api.AuditDetails;
+
+/** Records the removal of data from every dataset without retaining dataset data. */
+public record DatasetDataClearedDetails() implements AuditDetails {
+}
diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDataDeletedDetails.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDataDeletedDetails.java
new file mode 100644
index 0000000000..f8c8321357
--- /dev/null
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDataDeletedDetails.java
@@ -0,0 +1,25 @@
+/*
+ * 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.streampipes.audit.events.dataset;
+
+import org.apache.streampipes.audit.api.AuditDetails;
+
+/** Stores the optional exclusive time bounds of a dataset data deletion. */
+public record DatasetDataDeletedDetails(Long startExclusive, Long endExclusive) implements AuditDetails {
+}
diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDataTruncatedDetails.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDataTruncatedDetails.java
new file mode 100644
index 0000000000..24fb79fe44
--- /dev/null
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDataTruncatedDetails.java
@@ -0,0 +1,25 @@
+/*
+ * 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.streampipes.audit.events.dataset;
+
+import org.apache.streampipes.audit.api.AuditDetails;
+
+/** Records removal of all data from one dataset while retaining its metadata. */
+public record DatasetDataTruncatedDetails() implements AuditDetails {
+}
diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDroppedDetails.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDroppedDetails.java
new file mode 100644
index 0000000000..0e292d9e48
--- /dev/null
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDroppedDetails.java
@@ -0,0 +1,25 @@
+/*
+ * 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.streampipes.audit.events.dataset;
+
+import org.apache.streampipes.audit.api.AuditDetails;
+
+/** Records removal of both a dataset's data and its metadata. */
+public record DatasetDroppedDetails() implements AuditDetails {
+}
diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetRetentionConfiguredDetails.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetRetentionConfiguredDetails.java
new file mode 100644
index 0000000000..c7dfbfa677
--- /dev/null
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetRetentionConfiguredDetails.java
@@ -0,0 +1,25 @@
+/*
+ * 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.streampipes.audit.events.dataset;
+
+import org.apache.streampipes.audit.api.AuditDetails;
+
+/** Records a dataset retention configuration change without retaining its configuration. */
+public record DatasetRetentionConfiguredDetails() implements AuditDetails {
+}
diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetRetentionRemovedDetails.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetRetentionRemovedDetails.java
new file mode 100644
index 0000000000..ae5ba960a6
--- /dev/null
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetRetentionRemovedDetails.java
@@ -0,0 +1,25 @@
+/*
+ * 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.streampipes.audit.events.dataset;
+
+import org.apache.streampipes.audit.api.AuditDetails;
+
+/** Records removal of a dataset retention configuration. */
+public record DatasetRetentionRemovedDetails() implements AuditDetails {
+}
diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetRetentionRunDetails.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetRetentionRunDetails.java
new file mode 100644
index 0000000000..3947e23dc2
--- /dev/null
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetRetentionRunDetails.java
@@ -0,0 +1,25 @@
+/*
+ * 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.streampipes.audit.events.dataset;
+
+import org.apache.streampipes.audit.api.AuditDetails;
+
+/** Records a manual execution of dataset retention. */
+public record DatasetRetentionRunDetails() implements AuditDetails {
+}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dataset/DatasetResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dataset/DatasetResource.java
index cbb23e1e73..a9cac5c4d7 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dataset/DatasetResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dataset/DatasetResource.java
@@ -18,6 +18,7 @@
 
 package org.apache.streampipes.rest.impl.dataset;
 
+import org.apache.streampipes.audit.events.dataset.DatasetAuditReporter;
 import org.apache.streampipes.commons.exceptions.SpRuntimeException;
 import org.apache.streampipes.dataexplorer.export.ConfiguredOutputWriterFactory;
 import org.apache.streampipes.dataexplorer.export.OutputFormat;
@@ -106,6 +107,7 @@ public class DatasetResource extends AbstractDatasetResource {
   private final DatasetExportService exportService;
   private final IDatasetMetadataStorage datasetStorage;
   private final ConfiguredOutputWriterFactory outputWriterFactory;
+  private final DatasetAuditReporter datasetAudit;
 
   public DatasetResource(IChartStorage chartStorage,
                           SpResourceManager resourceManager, DatasetServices services) {
@@ -117,6 +119,7 @@ public class DatasetResource extends AbstractDatasetResource {
     this.outputWriterFactory = new ConfiguredOutputWriterFactory(
         resourceManager.getFileMetadataStorage(),
         resourceManager.getCoreConfigurationStorage());
+    this.datasetAudit = new DatasetAuditReporter(resourceManager.getAuditService());
     this.datasetExportManager = new DatasetExportManager(
         this.datasetMetadataManagement,
         services,
@@ -135,7 +138,15 @@ public class DatasetResource extends AbstractDatasetResource {
       @Parameter(in = ParameterIn.QUERY, description = "start date for slicing operation") @RequestParam(value = "startDate", required = false) Long startDate,
       @Parameter(in = ParameterIn.QUERY, description = "end date for slicing operation") @RequestParam(value = "endDate", required = false) Long endDate) {
 
+    var datasetId = this.datasetMetadataManagement.getExistingMeasureByName(measurementName)
+        .map(DatasetMetadata::getElementId)
+        .orElse(measurementName);
     if (this.administrationService.deleteData(measurementName, startDate, endDate)) {
+      if (startDate == null && endDate == null) {
+        datasetAudit.dataTruncated(getAuthenticatedUserSid(), datasetId);
+      } else {
+        datasetAudit.dataDeleted(getAuthenticatedUserSid(), datasetId, startDate, endDate);
+      }
       return ok(Notifications
           .success("Successfully deleted measure " + measurementName + " between " + startDate + " and " + endDate));
     } else {
@@ -155,11 +166,15 @@ public class DatasetResource extends AbstractDatasetResource {
   public ResponseEntity<?> dropMeasurementSeries(
       @Parameter(in = ParameterIn.PATH, description = "the id of the measurement series", required = true) @PathVariable("measurementID") String measurementID) {
 
+    var datasetId = this.datasetMetadataManagement.getExistingMeasureByName(measurementID)
+        .map(DatasetMetadata::getElementId)
+        .orElse(measurementID);
     boolean isSuccessDataLake = this.administrationService.deleteData(measurementID);
 
     if (isSuccessDataLake) {
       boolean isSuccessEventProperty = this.datasetMetadataManagement.deleteMeasurementByName(measurementID);
       if (isSuccessEventProperty) {
+        datasetAudit.dropped(getAuthenticatedUserSid(), datasetId);
         return ok();
       } else {
         return ResponseEntity
@@ -368,6 +383,9 @@ public class DatasetResource extends AbstractDatasetResource {
       @ApiResponse(responseCode = "200", description = "All measurement series successfully removed") })
   public ResponseEntity<?> removeAll() {
     boolean isSuccess = this.administrationService.deleteAllData();
+    if (isSuccess) {
+      datasetAudit.allDataCleared(getAuthenticatedUserSid());
+    }
     return ResponseEntity.ok(isSuccess);
   }
 
@@ -393,6 +411,7 @@ public class DatasetResource extends AbstractDatasetResource {
     measure.setRetentionTime(retention);
     try {
       this.datasetMetadataManagement.updateMeasurement(measure);
+      datasetAudit.retentionConfigured(getAuthenticatedUserSid(), elementId);
     } catch (IllegalArgumentException e) {
       return badRequest(e.getMessage());
     }
@@ -407,6 +426,7 @@ public class DatasetResource extends AbstractDatasetResource {
     measure.deleteRetentionTime();
     try {
       this.datasetMetadataManagement.updateMeasurement(measure);
+      datasetAudit.retentionRemoved(getAuthenticatedUserSid(), elementId);
     } catch (IllegalArgumentException e) {
       return badRequest(e.getMessage());
     }
@@ -423,6 +443,7 @@ public class DatasetResource extends AbstractDatasetResource {
     try {
       var measure = this.datasetMetadataManagement.getById(elementId);
       datasetExportManager.cleanupSingleMeasurement(measure);
+      datasetAudit.retentionRun(getAuthenticatedUserSid(), elementId);
       return ok();
 
     } catch (Exception e) {


(streampipes) 01/03: standard

Posted by ho...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

JHoelli pushed a commit to branch 5111-add-datasets-to-audit-log
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit c766081825bd92fd2ecfaa6e6ffadb38a534b6b2
Author: Jacqueline Höllig <j....@gmx.net>
AuthorDate: Thu Oct 22 13:33:26 2026 +0200

    standard
---
 .../audit/events/StandardAuditEvents.java          | 11 ++++
 .../audit/events/dataset/DatasetAuditReporter.java | 49 ++++++++++++++
 .../events/dataset/DatasetCreatedDetails.java      | 25 ++++++++
 .../events/dataset/DatasetDeletedDetails.java      | 25 ++++++++
 .../audit/events/dataset/DatasetEditedDetails.java | 25 ++++++++
 .../events/dataset/DatasetAuditReporterTest.java   | 74 ++++++++++++++++++++++
 .../rest/impl/dataset/DatasetMetadataResource.java | 12 ++++
 7 files changed, 221 insertions(+)

diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/StandardAuditEvents.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/StandardAuditEvents.java
index 77be74032a..931c1639b0 100644
--- a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/StandardAuditEvents.java
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/StandardAuditEvents.java
@@ -24,11 +24,21 @@ import org.apache.streampipes.audit.events.adapter.AdapterCreatedDetails;
 import org.apache.streampipes.audit.events.adapter.AdapterEditedDetails;
 import org.apache.streampipes.audit.events.adapter.AdapterLifecycleDetails;
 import org.apache.streampipes.audit.events.authentication.AuthenticationDetails;
+import org.apache.streampipes.audit.events.dataset.DatasetCreatedDetails;
+import org.apache.streampipes.audit.events.dataset.DatasetDeletedDetails;
+import org.apache.streampipes.audit.events.dataset.DatasetEditedDetails;
 
 import java.util.List;
 
 public final class StandardAuditEvents implements AuditEventProvider {
 
+  public static final AuditEventDefinition<DatasetCreatedDetails> DATASET_CREATE =
+      new AuditEventDefinition<>("sp.dataset.create", DatasetCreatedDetails.class, "dataset");
+  public static final AuditEventDefinition<DatasetEditedDetails> DATASET_EDIT =
+      new AuditEventDefinition<>("sp.dataset.edit", DatasetEditedDetails.class, "dataset");
+  public static final AuditEventDefinition<DatasetDeletedDetails> DATASET_DELETE =
+      new AuditEventDefinition<>("sp.dataset.delete", DatasetDeletedDetails.class, "dataset");
+
   public static final AuditEventDefinition<AdapterCreatedDetails> ADAPTER_CREATE =
       new AuditEventDefinition<>("sp.adapter.create", AdapterCreatedDetails.class, "adapter");
   public static final AuditEventDefinition<AdapterLifecycleDetails> ADAPTER_START =
@@ -45,6 +55,7 @@ public final class StandardAuditEvents implements AuditEventProvider {
 
 
   private static final List<AuditEventDefinition<?>> EVENT_TYPES = List.of(
+      DATASET_CREATE, DATASET_EDIT, DATASET_DELETE,
       ADAPTER_CREATE, ADAPTER_START, ADAPTER_STOP, ADAPTER_EDIT, AUTH_LOGIN, AUTH_LOGOUT);
 
   @Override
diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetAuditReporter.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetAuditReporter.java
new file mode 100644
index 0000000000..73703e8b18
--- /dev/null
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetAuditReporter.java
@@ -0,0 +1,49 @@
+/*
+ * 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.streampipes.audit.events.dataset;
+
+import org.apache.streampipes.audit.api.AuditOutcome;
+import org.apache.streampipes.audit.api.AuditService;
+import org.apache.streampipes.audit.events.StandardAuditEvents;
+
+import java.util.Objects;
+
+/** Publishes dataset lifecycle events with safe, resource-free details. */
+public final class DatasetAuditReporter {
+  private final AuditService auditService;
+
+  public DatasetAuditReporter(AuditService auditService) {
+    this.auditService = Objects.requireNonNull(auditService);
+  }
+
+  public void created(String actor, String datasetId) {
+    auditService.record(StandardAuditEvents.DATASET_CREATE, AuditOutcome.SUCCEEDED, actor, datasetId,
+        new DatasetCreatedDetails());
+  }
+
+  public void edited(String actor, String datasetId) {
+    auditService.record(StandardAuditEvents.DATASET_EDIT, AuditOutcome.SUCCEEDED, actor, datasetId,
+        new DatasetEditedDetails());
+  }
+
+  public void deleted(String actor, String datasetId) {
+    auditService.record(StandardAuditEvents.DATASET_DELETE, AuditOutcome.SUCCEEDED, actor, datasetId,
+        new DatasetDeletedDetails());
+  }
+}
diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetCreatedDetails.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetCreatedDetails.java
new file mode 100644
index 0000000000..5649929c4b
--- /dev/null
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetCreatedDetails.java
@@ -0,0 +1,25 @@
+/*
+ * 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.streampipes.audit.events.dataset;
+
+import org.apache.streampipes.audit.api.AuditDetails;
+
+/** The dataset ID is stored in the audit event envelope; no dataset data is retained. */
+public record DatasetCreatedDetails() implements AuditDetails {
+}
diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDeletedDetails.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDeletedDetails.java
new file mode 100644
index 0000000000..ac284e9d35
--- /dev/null
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetDeletedDetails.java
@@ -0,0 +1,25 @@
+/*
+ * 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.streampipes.audit.events.dataset;
+
+import org.apache.streampipes.audit.api.AuditDetails;
+
+/** The dataset ID is retained in the audit event envelope after deletion. */
+public record DatasetDeletedDetails() implements AuditDetails {
+}
diff --git a/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetEditedDetails.java b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetEditedDetails.java
new file mode 100644
index 0000000000..8a95d4ac0f
--- /dev/null
+++ b/streampipes-audit-events/src/main/java/org/apache/streampipes/audit/events/dataset/DatasetEditedDetails.java
@@ -0,0 +1,25 @@
+/*
+ * 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.streampipes.audit.events.dataset;
+
+import org.apache.streampipes.audit.api.AuditDetails;
+
+/** The dataset ID is stored in the audit event envelope; no dataset data is retained. */
+public record DatasetEditedDetails() implements AuditDetails {
+}
diff --git a/streampipes-audit-events/src/test/java/org/apache/streampipes/audit/events/dataset/DatasetAuditReporterTest.java b/streampipes-audit-events/src/test/java/org/apache/streampipes/audit/events/dataset/DatasetAuditReporterTest.java
new file mode 100644
index 0000000000..c5905447e3
--- /dev/null
+++ b/streampipes-audit-events/src/test/java/org/apache/streampipes/audit/events/dataset/DatasetAuditReporterTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.streampipes.audit.events.dataset;
+
+import org.apache.streampipes.audit.api.AuditDetails;
+import org.apache.streampipes.audit.api.AuditEventDefinition;
+import org.apache.streampipes.audit.api.AuditOutcome;
+import org.apache.streampipes.audit.api.AuditService;
+import org.apache.streampipes.audit.events.StandardAuditEvents;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class DatasetAuditReporterTest {
+
+  @Test
+  void reportsDatasetLifecycleEvents() {
+    var auditService = new RecordingAuditService();
+    var reporter = new DatasetAuditReporter(auditService);
+
+    reporter.created("user-1", "dataset-1");
+    reporter.edited("user-1", "dataset-1");
+    reporter.deleted("user-1", "dataset-1");
+
+    assertEquals(List.of(
+        new AuditRecord(StandardAuditEvents.DATASET_CREATE, AuditOutcome.SUCCEEDED,
+            "user-1", "dataset-1", new DatasetCreatedDetails()),
+        new AuditRecord(StandardAuditEvents.DATASET_EDIT, AuditOutcome.SUCCEEDED,
+            "user-1", "dataset-1", new DatasetEditedDetails()),
+        new AuditRecord(StandardAuditEvents.DATASET_DELETE, AuditOutcome.SUCCEEDED,
+            "user-1", "dataset-1", new DatasetDeletedDetails())
+    ), auditService.records);
+  }
+
+  private static final class RecordingAuditService implements AuditService {
+    private final List<AuditRecord> records = new ArrayList<>();
+
+    @Override
+    public <T extends AuditDetails> void record(AuditEventDefinition<T> definition,
+                                                AuditOutcome outcome,
+                                                String actor,
+                                                String resourceId,
+                                                T details) {
+      records.add(new AuditRecord(definition, outcome, actor, resourceId, details));
+    }
+  }
+
+  private record AuditRecord(AuditEventDefinition<?> definition,
+                            AuditOutcome outcome,
+                            String actor,
+                            String resourceId,
+                            AuditDetails details) {
+  }
+}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dataset/DatasetMetadataResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dataset/DatasetMetadataResource.java
index 31917f8143..5cad630917 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dataset/DatasetMetadataResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dataset/DatasetMetadataResource.java
@@ -18,6 +18,7 @@
 
 package org.apache.streampipes.rest.impl.dataset;
 
+import org.apache.streampipes.audit.events.dataset.DatasetAuditReporter;
 import org.apache.streampipes.dataexplorer.management.DataExplorerDispatcher;
 import org.apache.streampipes.manager.pipeline.update.ChartSchemaUpdateCoordinator;
 import org.apache.streampipes.model.dataset.DatasetMetadata;
@@ -49,11 +50,13 @@ import java.util.Objects;
 @RequestMapping("/api/v4/datalake/measure")
 public class DatasetMetadataResource extends AbstractDatasetResource {
 
+  private final DatasetAuditReporter datasetAudit;
   private final SpResourceManager resourceManager;
 
   public DatasetMetadataResource(IChartStorage chartStorage,
                                  SpResourceManager resourceManager) {
     super(new ChartSchemaUpdateCoordinator(chartStorage), resourceManager);
+    this.datasetAudit = new DatasetAuditReporter(resourceManager.getAuditService());
     this.resourceManager = resourceManager;
   }
 
@@ -67,10 +70,17 @@ public class DatasetMetadataResource extends AbstractDatasetResource {
   @PreAuthorize("this.hasWriteAuthority()")
   public ResponseEntity<?> addDataLake(@RequestBody DatasetMetadata datasetMetadata) {
     try {
+      var existingDataset = this.datasetMetadataManagement
+          .getExistingMeasureByName(datasetMetadata.getMeasureName());
       DatasetMetadata result = this.datasetMetadataManagement.createOrUpdateMeasurement(
           datasetMetadata,
           getAuthenticatedUserSid()
       );
+      if (existingDataset.isPresent()) {
+        datasetAudit.edited(getAuthenticatedUserSid(), result.getElementId());
+      } else {
+        datasetAudit.created(getAuthenticatedUserSid(), result.getElementId());
+      }
       return ok(result);
     } catch (RuntimeException e) {
       return badRequest(SpLogMessage.from(e));
@@ -141,6 +151,7 @@ public class DatasetMetadataResource extends AbstractDatasetResource {
     if (elementId.equals(measure.getElementId())) {
       try {
         this.datasetMetadataManagement.updateMeasurement(measure);
+        datasetAudit.edited(getAuthenticatedUserSid(), elementId);
         return ok();
       } catch (IllegalArgumentException e) {
         return badRequest(e.getMessage());
@@ -154,6 +165,7 @@ public class DatasetMetadataResource extends AbstractDatasetResource {
   public ResponseEntity<?> deleteDatasetMetadata(@PathVariable("id") String elementId) {
     try {
       this.datasetMetadataManagement.deleteMeasurement(elementId);
+      datasetAudit.deleted(getAuthenticatedUserSid(), elementId);
       return ok();
     } catch (IllegalArgumentException e) {
       return badRequest(e.getMessage());