Skip to content

Commit 6c77b88

Browse files
ekneg54djkhl
andauthored
replace quickstart setup by deployment examples for helm and compose (#622)
* move quickstart to examples/compose * add helm installation option * add opensiem example * add istio installation * add istio gateway and virtual service * use ingress in favor of istio * update chart version * update documentation for utilizing fda and ucl in compose example for little bit more consistency --------- Co-authored-by: djkhl <[email protected]>
1 parent f06e3e4 commit 6c77b88

File tree

82 files changed

+523
-139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+523
-139
lines changed

.github/secret_scanning.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
paths-ignore:
2-
- "quickstart/exampledata/config/credentials.yml"
3-
- "quickstart/exampledata/config/nginx/mtls.conf.d/*.key"
4-
- "quickstart/exampledata/config/nginx/mtls.conf.d/*.crt"
2+
- "examples/exampledata/config/credentials.yml"
3+
- "examples/exampledata/config/nginx/mtls.conf.d/*.key"
4+
- "examples/exampledata/config/nginx/mtls.conf.d/*.crt"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ experiments
2525
**/_static/*.xlsx
2626
logprep.log
2727
/charts/logprep/charts
28+
examples/k8s/charts

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
## next release
44
### Breaking
55
### Features
6+
67
### Improvements
78

89
* a result object was added to processors and pipelines
910
* each processor returns an object including the processor name, generated extra_data, warnings
1011
and errors
1112
* the pipeline returns an object with the list of all processor result objects
13+
* add kubernetes opensiem deployment example
14+
* move quickstart setup to compose example
1215

1316
### Bugfix
1417

@@ -316,7 +319,7 @@
316319

317320
* add possibility to convert hex to int in `calculator` processor with new added function `from_hex`
318321
* add metrics on rule level
319-
* add grafana example dashboards under `quickstart/exampledata/config/grafana/dashboards`
322+
* add grafana example dashboards under `examples/exampledata/config/grafana/dashboards`
320323
* add new configuration field `id` for all rules to identify rules in metrics and logs
321324
- if no `id` is given, the `id` will be generated in a stable way
322325
- add verification of rule `id` uniqueness on processor level over both rule trees to ensure metrics are counted correctly on rule level

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ allowing further applications besides log handling.
2929
This readme provides basic information about the following topics:
3030
- [About Logprep](#about-logprep)
3131
- [Getting Started](https://logprep.readthedocs.io/en/latest/getting_started.html)
32-
- [Docker Quickstart](https://logprep.readthedocs.io/en/latest/getting_started.html#logprep-quickstart-environment)
32+
- [Deployment Examples](https://logprep.readthedocs.io/en/latest/examples/index.html)
3333
- [Event Generation](https://logprep.readthedocs.io/en/latest/user_manual/execution.html#event-generation)
3434
- [Documentation](https://logprep.readthedocs.io/en/latest)
3535
- [Contributing](#contributing)

charts/logprep/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type: application
66
# This is the chart version. This version number should be incremented each time you make changes
77
# to the chart and its templates, including the app version.
88
# Versions are expected to follow Semantic Versioning (https://semver.org/)
9-
version: "13.2.0"
9+
version: "13.2.1"
1010

1111
# This is the version number of the application being deployed. This version number should be
1212
# incremented each time you make changes to the application. Versions are not expected to

charts/logprep/templates/deployment.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: apps/v1
33
kind: Deployment
44
metadata:
5-
name: {{ include "logprep.name" . }}
5+
name: {{ include "logprep.fullname" . }}
66
labels:
77
{{- include "logprep.labels" . | nindent 4 }}
88
spec:
@@ -14,6 +14,7 @@ spec:
1414
{{- include "logprep.selectorLabels" . | nindent 6 }}
1515
template:
1616
metadata:
17+
name: {{ include "logprep.fullname" . }}
1718
labels:
1819
{{- include "logprep.labels" . | nindent 8 }}
1920
annotations:

charts/logprep/values.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ logger:
118118
#
119119
# See https://logprep.readthedocs.io/en/latest/user_manual/configuration/input.html
120120
# for available configuration options.
121+
# Note:
122+
# For the `http_input` endpoints you have to add the endpoint `/health: plaintext` to ensure
123+
# readiness probes are working.
121124
input: {}
122125

123126
# The logprep output connector configuration

doc/source/development/programaticly_start_logprep.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ An example with input connector and preprocessors could look like this:
2323
"predetector": {
2424
"type": "pre_detector",
2525
"specific_rules": [
26-
"quickstart/exampledata/rules/pre_detector/specific"
26+
"examples/exampledata/rules/pre_detector/specific"
2727
],
2828
"generic_rules": [
29-
"quickstart/exampledata/rules/pre_detector/generic"
29+
"examples/exampledata/rules/pre_detector/generic"
3030
],
3131
"pre_detector_topic": "output_topic"
3232
}
@@ -61,10 +61,10 @@ An example without input connector and preprocessors could look like this:
6161
"predetector": {
6262
"type": "pre_detector",
6363
"specific_rules": [
64-
"quickstart/exampledata/rules/pre_detector/specific"
64+
"examples/exampledata/rules/pre_detector/specific"
6565
],
6666
"generic_rules": [
67-
"quickstart/exampledata/rules/pre_detector/generic"
67+
"examples/exampledata/rules/pre_detector/generic"
6868
],
6969
"pre_detector_topic": "output_topic"
7070
}

doc/source/examples/compose.rst

+29-24
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Docker Compose Example Deployment
55
To demonstrate the functionality of logprep this repo comes with a complete `kafka`, `logprep` and
66
`opensearch` stack.
77
To get it running `docker` with compose support must be first installed.
8-
The docker compose file is located in the directory `quickstart`.
8+
The docker compose file is located in the directory `examples/compose`.
99
A prerequisite is to run `sysctl -w vm.max_map_count=262144`, otherwise Opensearch might not
1010
properly start.
1111

@@ -14,7 +14,7 @@ The environment can either be started with a Logprep container or without one:
1414
Run without Logprep Container (default)
1515
---------------------------------------
1616

17-
1. Run from within the `quickstart` directory:
17+
1. Run from within the `examples/compose` directory:
1818

1919
.. code-block:: bash
2020
@@ -25,22 +25,22 @@ Run without Logprep Container (default)
2525

2626
.. code-block:: bash
2727
28-
logprep run quickstart/exampledata/config/pipeline.yml
28+
logprep run examples/exampledata/config/pipeline.yml
2929
3030
If logprep is run with the metrics enabled, the necessary environment variable has to be set first:
3131

3232
.. code-block:: bash
3333
3434
export PROMETHEUS_MULTIPROC_DIR="tmp/logprep"
35-
logprep run quickstart/exampledata/config/pipeline.yml
35+
logprep run examples/exampledata/config/pipeline.yml
3636
3737
3838
3939
4040
Run with Logprep Container
4141
--------------------------
4242

43-
* Run from within the `quickstart` directory:
43+
* Run from within the `examples/compose` directory:
4444

4545
.. code-block:: bash
4646
@@ -50,7 +50,7 @@ Run with Logprep Container
5050
Run with getting config from http server with basic authentication
5151
------------------------------------------------------------------
5252

53-
* Run from within the `quickstart` directory:
53+
* Run from within the `examples/compose` directory:
5454

5555
.. code-block:: bash
5656
@@ -60,14 +60,14 @@ Run with getting config from http server with basic authentication
6060

6161
.. code-block:: bash
6262
63-
export LOGPREP_CREDENTIALS_FILE="quickstart/exampledata/config/credentials.yml"
63+
export LOGPREP_CREDENTIALS_FILE="examples/exampledata/config/credentials.yml"
6464
logprep run http://localhost:8081/config/pipeline.yml
6565
6666
6767
Run with getting config from http server with mTLS authentication
6868
-----------------------------------------------------------------
6969

70-
* Run from within the `quickstart` directory:
70+
* Run from within the `examples/compose` directory:
7171

7272
.. code-block:: bash
7373
@@ -77,12 +77,12 @@ Run with getting config from http server with mTLS authentication
7777

7878
.. code-block:: bash
7979
80-
export LOGPREP_CREDENTIALS_FILE="quickstart/exampledata/config/credentials.yml"
80+
export LOGPREP_CREDENTIALS_FILE="examples/exampledata/config/credentials.yml"
8181
logprep run https://localhost:8082/config/pipeline.yml
8282
8383
84-
Interacting with the Quickstart Environment
85-
-------------------------------------------
84+
Interacting with the Compose Environment
85+
----------------------------------------
8686

8787
The start up takes a few seconds to complete, but once everything is up
8888
and running it is possible to write JSON events into Kafka and read the processed events in
@@ -111,9 +111,9 @@ UCL Postgres: `localhost:5432` ucl ucl
111111
====================== ================= ======================== =======================
112112

113113
The example rules that are used in the docker instance of Logprep can be found
114-
in `quickstart/exampledata/rules`.
114+
in `examples/exampledata/rules`.
115115
Example events that trigger for the example rules can be found in
116-
`quickstart/exampledata/input_logdata/logclass/test_input.jsonl`.
116+
`examples/exampledata/input_logdata/logclass/test_input.jsonl`.
117117
These events can be added to Kafka with the following command:
118118

119119
.. code-block:: bash
@@ -133,12 +133,17 @@ Utilizing FDA and UCL
133133
If you want to try out the FDA and UCL you first have to do some preparations.
134134

135135

136-
0. Run the quickstart setup with the :code:`oauth2` profile:
137-
:code:`docker compose --profile oauth2 up -d`.
136+
0. Run the example compose setup with the :code:`oauth2` profile:
137+
138+
.. code-block:: bash
139+
140+
docker compose --profile oauth2 up -d.
141+
142+
138143
1. Sign into the keycloak admin panel and create a logprep user in the :code:`logprep` realm.
139144
Make sure that the user is part of the :code:`logprep-admin` group and has a password. If you
140145
choose a password other than :code:`logprep` you have to update the credentials file
141-
:code:`quickstart/exampledata/config/credentials.yml`, such that the password of
146+
:code:`examples/exampledata/config/credentials.yml`, such that the password of
142147
:code:`http://localhost:3001` and :code:`http://localhost:3002` reflects your choice.
143148
2. You have to login to the FDA with the previously created user and create a release, as well
144149
as your first logclass. It is also necessary to add an example event to this logclass in order
@@ -148,19 +153,19 @@ If you want to try out the FDA and UCL you first have to do some preparations.
148153
your created logprep user and then configure required Use-Cases.
149154
At the current moment these configuration are not yet processed by logprep though, as the ucl
150155
only provides a mock endpoint which doesn't contain your Use-Case configurations.
151-
4. Set the env :code:`LOGPREP_CREDENTIALS_FILE` to :code:`quickstart/exampledata/config/credentials.yml`
156+
4. Set the env and run logprep
157+
158+
.. code-block:: bash
159+
160+
export LOGPREP_CREDENTIALS_FILE="examples/exampledata/config/credentials.yml"
161+
logprep run examples/exampledata/config/pipeline.yml "http://localhost:3002/api/v1/pipelines?stage=prod&logclass=ExampleClass" "http://localhost:3001/api/v1/general-predetection"
152162
153-
Once you have set everything up you can run logprep with the following command.
154163
Just consider that the first :code:`pipeline.yml` argument is used to define a proper :code:`input`
155164
and :code:`output` as those are not part of the FDA/UCL output. Also, in the second argument
156165
you should ensure that the :code:`stage` and :code:`loglcass` are set properly.
157166

158-
.. code-block:: bash
159-
160-
logprep run quickstart/exampledata/config/pipeline.yml "http://localhost:3002/api/v1/pipelines?stage=prod&logclass=ExampleClass" "http://localhost:3001/api/v1/general-predetection"
161-
162167
.. note::
163168

164-
If you did use the quickstart setup before and run into problems it is advised to first pull
169+
If you did use the example compose setup before and run into problems it is advised to first pull
165170
all images again to update them to the latest version:
166-
:code:`docker compose -f ./quickstart/docker-compose.yml pull`.
171+
:code:`docker compose -f ./examples/compose/docker-compose.yml pull`.

doc/source/examples/minikube.rst

+61-3
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,26 @@ with the following commands:
4545
sudo mv linux-amd64/helm /usr/local/bin/helm
4646
sudo chmod +x /usr/local/bin/helm
4747
48+
.. code-block:: bash
49+
:caption: add helm repositories
50+
51+
helm repo add bitnami https://charts.bitnami.com/bitnami
52+
4853
.. code-block:: bash
4954
:caption: Configure and start minikube
5055
5156
minikube config set driver docker
57+
minikube config set cpus 16
58+
minikube config set memory 16GB
59+
minikube addons enable ingress
5260
minikube start
5361
5462
Deploy the example
5563
------------------
5664

65+
The following steps install the actual opensiem example on the minikube cluster.
66+
It will install
67+
5768
At first you have to install the prometheus PodMonitor CRD:
5869

5970
.. code-block:: bash
@@ -62,9 +73,56 @@ At first you have to install the prometheus PodMonitor CRD:
6273
kubectl apply -f https://raw.githubusercontent.com/prometheus-community/helm-charts/main/charts/kube-prometheus-stack/charts/crds/crds/crd-podmonitors.yaml
6374
6475
65-
Next you can install logprep using:
76+
Then you have to update and build the helm subcharts repository:
6677

6778
.. code-block:: bash
68-
:caption: Install logprep
79+
:caption: Add the bitnami helm repository
80+
81+
helm dependencies update ./examples/k8s
82+
helm dependencies build ./examples/k8s
83+
84+
Next you are ready to install the opensiem example using:
6985

70-
helm install logprep charts/logprep
86+
.. code-block:: bash
87+
:caption: Install opensiem
88+
89+
helm install opensiem examples/k8s
90+
91+
Make the cluster locally resolvable:
92+
93+
.. code-block:: bash
94+
:caption: add hosts entry to resolve the cluster
95+
96+
echo "$( minikube ip ) connector.opensiem dashboards.opensiem grafana.opensiem" | sudo tee -a /etc/hosts
97+
98+
Test the defined ingresses:
99+
100+
.. code-block:: bash
101+
:caption: Test the opensiem example ingress
102+
103+
curl -v http://connector.opensiem/health
104+
curl -v http://dashboards.opensiem
105+
106+
Test the opensiem connector:
107+
108+
.. code-block:: bash
109+
:caption: Test the opensiem example connector
110+
111+
❯ logprep generate http --input-dir ./examples/exampledata/input_logdata/ --target-url http://connector.opensiem --events 100 --batch-size 10
112+
113+
2024-07-17 11:15:35 301643 Generator INFO : Log level set to 'NOTSET'
114+
2024-07-17 11:15:35 301643 Generator INFO : Started Data Processing
115+
2024-07-17 11:15:35 301643 Input INFO : Reading input dataset and creating temporary event collections in: '/tmp/logprep_a51e1vh6'
116+
2024-07-17 11:15:35 301643 Input INFO : Preparing data took: 0.0042 seconds
117+
2024-07-17 11:15:35 301643 Input INFO : Cleaned up temp dir: '/tmp/logprep_a51e1vh6'
118+
2024-07-17 11:15:35 301643 Generator INFO : Completed with following statistics: {
119+
"Number of failed events": 0,
120+
"Number of successfull events": 100,
121+
"Requests Connection Errors": 0,
122+
"Requests Timeouts": 0,
123+
"Requests http status 200": 10,
124+
"Requests total": 10
125+
}
126+
2024-07-17 11:15:35 301643 Generator INFO : Execution time: 0.067013 seconds
127+
128+
open your browser and go to `http://dashboards.opensiem`_ to see the generated data in the opensearch dashboards.

doc/source/installation.rst

+23-1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,26 @@ Helm
6161

6262
This option can be used to deploy logprep on a kubernetes cluster.
6363

64-
tbd
64+
At first you have to install the prometheus PodMonitor CRD:
65+
66+
.. code-block:: bash
67+
:caption: Install the prometheus PodMonitor CRD
68+
69+
kubectl apply -f https://raw.githubusercontent.com/prometheus-community/helm-charts/main/charts/kube-prometheus-stack/charts/crds/crds/crd-podmonitors.yaml
70+
71+
72+
To install latest stable release:
73+
74+
.. code-block:: bash
75+
76+
helm repo add logprep https://fkie-cad.github.io/Logprep
77+
helm install logprep logprep/logprep
78+
79+
80+
To install from cloned github repository:
81+
82+
.. code-block:: bash
83+
84+
git clone https://github.com/fkie-cad/Logprep.git
85+
cd Logprep
86+
helm install logprep charts/logprep

0 commit comments

Comments
 (0)