mirror of
https://dev.azure.com/schwarzit/schwarzit.stackit-public/_git/audit-go
synced 2026-02-07 16:47:24 +00:00
- Update dependencies - Update related code adjustments - Add sonarqube configuration and pipeline adjustments Security-concept-update-needed: false. JIRA Work Item: [STACKITRMA-822](https://jira.schwarz/browse/STACKITRMA-822)
129 lines
5 KiB
Markdown
129 lines
5 KiB
Markdown
> ## DEPRECATION NOTICE
|
|
>
|
|
> ### Discontinuation of the current audit log system
|
|
>
|
|
> The audit log system provided to date will be discontinued in its current form.
|
|
> This decision was made to pave the way for a new, more powerful audit log system that
|
|
> will be provided in the future. The new system offers extended functionalities and
|
|
> improved integration options, particularly with regard to the use and analysis of
|
|
> audit data by our customers.
|
|
>
|
|
> ### What does it mean?
|
|
> The existing audit log system will be supported until the new system is generally
|
|
> available to customers on Mai 1, 2026.
|
|
> **Services that are already sending audit log events to the existing audit log
|
|
> system must continue to do so until the new system is GA** and further information
|
|
> about the shutdown process is provided.
|
|
> **Large volumes of new audit event types must not be sent to the existing audit log
|
|
> system.**
|
|
>
|
|
> STACKIT services should start migrating to the new system now by sending data to
|
|
> the new system (**in parallel**).
|
|
> **The new audit log system may drop and does not guarantee to store events until
|
|
> it will be GA**.
|
|
> Further information on the changeover and how to use the new system can be found in the
|
|
> [developer docs](https://developers.stackit.schwarz/domains/central-services/telemetry-router/integration/).
|
|
>
|
|
> We are confident that the new audit log system will make an important contribution to
|
|
> improving the transparency, traceability, and integration for our customers.
|
|
> If you have any questions or need assistance, the
|
|
> [STACKIT Telemetry Hub](https://chat.google.com/room/AAQAf9NsX6M?cls=7) team will be
|
|
> happy to help.
|
|
|
|
## audit-go
|
|
|
|
The audit-go library is the core library for validation and sending of audit events.
|
|
|
|
### API Documentation
|
|
|
|
The api documentation can be found
|
|
[here](https://developers.stackit.schwarz/domains/core-platform/audit-log/sdk/overview/).
|
|
|
|
### Supported data types for routing
|
|
|
|
The following data types are currently supported for routing.
|
|
|
|
| ObjectType | Routable to customer | Description |
|
|
|--------------|----------------------|----------------------|
|
|
| system | no | The STACKIT system |
|
|
| project | yes | STACKIT project |
|
|
| organization | yes | STACKIT organization |
|
|
| folder | yes | STACKIT folder |
|
|
|
|
### Additional API implementations
|
|
|
|
There's already an implementation draft of the api for the new dynamically routing
|
|
audit log solution. As the implementation of the system has not officially been
|
|
started yet, it's only a draft with integration tests.
|
|
The API code is private to not confuse users or loose data until the new system
|
|
is ready to be used.
|
|
|
|
The code can be found in the [api_routable.go](./api_routable.go) and
|
|
[api_routable_test.go](./api_routable_test.go) files.
|
|
|
|
### Development
|
|
|
|
#### Go
|
|
The current minimum Go version is **go1.24.0**.
|
|
|
|
#### Linter
|
|
|
|
The linter *golangci-lint* can either be installed via package manager (e.g. brew) or
|
|
by running the following command in the terminal:
|
|
|
|
```shell
|
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.8.0
|
|
```
|
|
|
|
#### Schema Generation
|
|
|
|
Go structs are generated from Protobuf schema by using [Buf](https://buf.build) and some plugins.
|
|
The buf plugins are referenced in the *proto/buf.gen.yaml* file and are expected
|
|
to be installed locally.
|
|
The schema generator also generates code to validate constraints specified
|
|
in the schema.
|
|
|
|
Buf and the required plugins can either be installed via package manager (e.g. brew)
|
|
or manually by running:
|
|
|
|
```shell
|
|
go install github.com/bufbuild/buf/cmd/buf@v1.63.0 #Pipeline: bufVersion
|
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.11 #Pipeline: protobufVersion, go.mod: buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go
|
|
go install github.com/envoyproxy/protoc-gen-validate@v1.3.0 #Pipeline: protobufValidateVersion, go.mod: google.golang.org/protobuf
|
|
```
|
|
|
|
Please check that the versions above match the versions in the *go.mod* file
|
|
and the *.azuredevops/build-pipeline.yml* file.
|
|
|
|
Then the schema can be generated:
|
|
|
|
```bash
|
|
cd proto
|
|
buf generate
|
|
```
|
|
|
|
#### Build
|
|
|
|
The library can be built by executing the following commands:
|
|
|
|
```bash
|
|
go mod download && go mod tidy && go get ./... && go fmt ./... && go vet ./... && golangci-lint run && go build ./... && go test ./...
|
|
```
|
|
|
|
##### Testcontainers
|
|
|
|
To run the tests **Docker** is needed as [Testcontainers](https://testcontainers.com/)
|
|
is used to run integration tests using a solace docker container.
|
|
|
|
#### Register buf validation schema in IntelliJ / Goland
|
|
|
|
The schema files use `Buf` protobuf extensions for validation of constraints.
|
|
|
|
To register the schema in IntelliJ / Goland clone the repo and add the import path:
|
|
|
|
```bash
|
|
git clone https://github.com/bufbuild/protovalidate.git
|
|
```
|
|
|
|
IntelliJ/Goland > Settings > Languages & Frameworks > Protocol Buffers > Import Paths > +
|
|
(Add Path) > …/protovalidate/proto/protovalidate
|