Skip to content

Commit 71c7e56

Browse files
mocsharpneildsouth
andauthored
Use NLog (#198)
Signed-off-by: Victor Chang <[email protected]> Co-authored-by: Neil South <[email protected]>
1 parent 77a745d commit 71c7e56

37 files changed

+1252
-3416
lines changed

.github/containerscan/allowedlist.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
general:
1616
vulnerabilities:
1717
- CVE-2018-8292
18+
- CVE-1999-1278

.licenserc.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ header:
3333
- 'src/Database/Migrations/**'
3434
- 'demos/**/.env/**'
3535
- 'demos/**/*.txt'
36+
- 'doc/dependency_decisions.yml'
37+
- 'docker-compose/configs/kibana.ndjson'
3638
- 'docs/templates/**'
3739
- 'tests/Integration.Test/*.dev'
3840
- 'tests/Integration.Test/data/**'

Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ RUN dotnet publish -c Release -o out --nologo src/InformaticsGateway/Monai.Deplo
2828
# Build runtime image
2929
FROM mcr.microsoft.com/dotnet/aspnet:6.0-jammy
3030

31+
# Enable elastic client compatibility mode
32+
ENV ELASTIC_CLIENT_APIVERSIONING=true
3133
ENV DEBIAN_FRONTEND=noninteractive
34+
3235
RUN apt-get clean \
3336
&& apt-get update \
3437
&& apt-get install -y --no-install-recommends \

doc/dependency_decisions.yml

+31-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
- :who: mocsharp
4747
:why: MIT (https://github.com/Cysharp/ConsoleAppFramework/raw/master/LICENSE)
4848
:versions:
49-
- 4.2.3
49+
- 4.2.4
5050
:when: 2022-08-16 23:05:31.110052610 Z
5151
- - :approve
5252
- Crayon
@@ -808,14 +808,14 @@
808808
- :who: mocsharp
809809
:why: Apache-2.0 (https://github.com/Project-MONAI/monai-deploy-messaging/raw/main/LICENSE)
810810
:versions:
811-
- 0.1.6
811+
- 0.1.8
812812
:when: 2022-08-16 23:06:21.051573547 Z
813813
- - :approve
814814
- Monai.Deploy.Messaging.RabbitMQ
815815
- :who: mocsharp
816816
:why: Apache-2.0 (https://github.com/Project-MONAI/monai-deploy-messaging/raw/main/LICENSE)
817817
:versions:
818-
- 0.1.6
818+
- 0.1.8
819819
:when: 2022-08-16 23:06:21.511789690 Z
820820
- - :approve
821821
- Monai.Deploy.Storage
@@ -1694,7 +1694,6 @@
16941694
:versions:
16951695
- 4.7.2
16961696
:when: 2022-08-16 23:07:19.845361666 Z
1697-
16981697
- - :approve
16991698
- System.Text.Json
17001699
- :who: mocsharp
@@ -2370,3 +2369,31 @@
23702369
:versions:
23712370
- 4.0.1
23722371
:when: 2022-08-16 23:10:21.184627612 Z
2372+
- - :approve
2373+
- NLog
2374+
- :who: mocsharp
2375+
:why: BSD 3-Clause License (https://github.com/NLog/NLog/raw/dev/LICENSE.txt)
2376+
:versions:
2377+
- 5.0.4
2378+
:when: 2022-10-12 03:14:06.538744982 Z
2379+
- - :approve
2380+
- NLog.Extensions.Logging
2381+
- :who: mocsharp
2382+
:why: BSD 2-Clause Simplified License (https://github.com/NLog/NLog.Extensions.Logging/raw/master/LICENSE)
2383+
:versions:
2384+
- 5.0.4
2385+
:when: 2022-10-12 03:14:06.964203977 Z
2386+
- - :approve
2387+
- NLog.Web.AspNetCore
2388+
- :who: mocsharp
2389+
:why: BSD 3-Clause License (https://github.com/NLog/NLog.Web/raw/master/LICENSE)
2390+
:versions:
2391+
- 5.1.4
2392+
:when: 2022-10-12 03:14:07.396706995 Z
2393+
- - :approve
2394+
- fo-dicom.NLog
2395+
- :who: mocsharp
2396+
:why: Microsoft Public License (https://github.com/fo-dicom/fo-dicom/raw/development/License.txt)
2397+
:versions:
2398+
- 5.0.3
2399+
:when: 2022-10-12 03:14:08.789273776 Z

docker-compose/.env

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2022 MONAI Consortium
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ELASTIC_VERSION=8.4.2
16+
17+
18+
# Elastic Search
19+
# User 'elastic' (built-in)
20+
ELASTIC_PASSWORD='monai'
21+
22+
# Logstash
23+
# User 'logstash_internal' (custom)
24+
LOGSTASH_INTERNAL_PASSWORD='monai'
25+
26+
# Kibana
27+
# User 'kibana_system' (built-in)
28+
KIBANA_SYSTEM_PASSWORD='monai'

docker-compose/README.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!--
2+
Copyright 2022 MONAI Consortium
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
# MONAI Deploy Informatics Gateway
18+
19+
The [docker-compose.yml](./docker-compose.yml) file includes the following services to run the Informatics Gateway.
20+
21+
* MinIO
22+
* RabbitMQ
23+
* ElasticSearch (optional)
24+
* LogStash (optional)
25+
* Kibana (optional)
26+
27+
28+
## Running docker compose
29+
30+
To start all Informatics Gateway dependencies, run `docker compose up`.
31+
32+
Before running Informatics Gateway, ensure the following environment variables are exported:
33+
34+
```bash
35+
export DOTNET_ENVIRONMENT=Development # if using appsettings.Development.json
36+
export LOGSTASH_URL=tcp://localhost:50000 # this tells Informatics Gateway to export logs to LogStash at tcp://localhost:5000
37+
```
38+
IMPORTANT: for Linux users, before running `docker compose up`, please run `init.sh` to create directories with the correct permissions first. Otherwise, ElasticSearch will not be able to start.
39+
40+
### Kibana
41+
42+
A default search is imported to Kibana at startup. To load the saved search, go to Analytics > Discover from the 🍔 menu. From the top right click *Open* and select *MONAI-Default*.
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2022 MONAI Consortium
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
---
16+
17+
## Default Elasticsearch configuration from Elasticsearch base image.
18+
## https://github.com/elastic/elasticsearch/blob/main/distribution/docker/src/docker/config/elasticsearch.yml
19+
#
20+
cluster.name: "docker-cluster"
21+
network.host: 0.0.0.0
22+
23+
## X-Pack settings
24+
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html
25+
#
26+
xpack.security.enabled: false
27+
xpack.license.self_generated.type: basic

docker-compose/configs/kibana.ndjson

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{"attributes":{"fieldAttrs":"{\"@version\":{\"count\":1},\"EventId\":{\"count\":3},\"Level\":{\"count\":4},\"LoggerName\":{\"count\":3},\"MachineName\":{\"count\":1},\"Message\":{\"count\":2},\"ServiceName\":{\"count\":1},\"ServiceVersion\":{\"count\":1}}","fields":"[]","name":"monai-deploy","runtimeFieldMap":"{}","sourceFilters":"[]","timeFieldName":"@timestamp","title":"monai-deploy-*","typeMeta":"{}"},"coreMigrationVersion":"8.4.2","id":"6c4ef8fa-f382-4dad-8c82-f180f09fc88d","migrationVersion":{"index-pattern":"8.0.0"},"references":[],"type":"index-pattern","updated_at":"2022-10-11T21:54:09.450Z","version":"Wzc2MiwxXQ=="}
2+
{"attributes":{"columns":["EventId","Level","LoggerName","Message"],"description":"","grid":{"columns":{"EventId":{"width":124},"Level":{"width":67.66666666666663},"LoggerName":{"width":668.1666666666667}}},"hideChart":false,"isTextBasedQuery":false,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[{\"meta\":{\"type\":\"phrases\",\"key\":\"Level\",\"params\":[\"TRACE\"],\"alias\":null,\"negate\":true,\"disabled\":false,\"value\":[\"TRACE\"],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index\"},\"query\":{\"bool\":{\"should\":[{\"match_phrase\":{\"Level\":\"TRACE\"}}],\"minimum_should_match\":1}},\"$state\":{\"store\":\"appState\"}}],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"},"sort":[["@timestamp","desc"]],"title":"MONAI-Default"},"coreMigrationVersion":"8.4.2","id":"48ce7db0-49af-11ed-bde2-430e63791a09","migrationVersion":{"search":"8.0.0"},"references":[{"id":"6c4ef8fa-f382-4dad-8c82-f180f09fc88d","name":"kibanaSavedObjectMeta.searchSourceJSON.index","type":"index-pattern"},{"id":"6c4ef8fa-f382-4dad-8c82-f180f09fc88d","name":"kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index","type":"index-pattern"}],"type":"search","updated_at":"2022-10-11T21:54:30.795Z","version":"Wzc3NSwxXQ=="}
3+
{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":2,"missingRefCount":0,"missingReferences":[]}

docker-compose/configs/kibana.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2022 MONAI Consortium
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
---
16+
## Default Kibana configuration from Kibana base image.
17+
## https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/templates/kibana_yml.template.ts
18+
#
19+
server.name: kibana
20+
server.host: 0.0.0.0
21+
elasticsearch.hosts: [ "http://elasticsearch:9200" ]
22+
monitoring.ui.container.elasticsearch.enabled: true
23+
24+
## X-Pack security credentials
25+
#
26+
elasticsearch.username: kibana_system
27+
elasticsearch.password: monai

docker-compose/configs/logstash.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2022 MONAI Consortium
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
---
15+
## Default Logstash configuration from Logstash base image.
16+
## https://github.com/elastic/logstash/blob/main/docker/data/logstash/config/logstash-full.yml
17+
#
18+
http.host: "0.0.0.0"

docker-compose/configs/pipeline.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2022 MONAI Consortium
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
- pipeline.id: monei-deploy
15+
path.config: "/usr/share/logstash/pipeline/monai-deploy.conf"
16+
queue.type: persisted
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright 2022 MONAI Consortium
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
input {
17+
tcp {
18+
port => 50000
19+
type => nlog
20+
}
21+
}
22+
23+
filter {
24+
if [type] == "nlog" {
25+
mutate {
26+
remove_field => [ "host" ]
27+
}
28+
json {
29+
source => "message"
30+
remove_field => [ "message" ]
31+
}
32+
date{
33+
match => [ "Timestamp", "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSZ" ]
34+
}
35+
36+
mutate {
37+
remove_field => [ "time" ]
38+
}
39+
}
40+
}
41+
42+
output {
43+
elasticsearch {
44+
hosts => "elasticsearch:9200"
45+
index => "monai-deploy-%{+YYYY.MM.dd}"
46+
}
47+
}

docker-compose/docker-compose.dev.yml

-71
This file was deleted.

0 commit comments

Comments
 (0)