chore: 🔧 enable logs capturing by default (#1534)

Signed-off-by: Prashant Shahi <prashant@signoz.io>
This commit is contained in:
Prashant Shahi 2022-08-24 15:11:38 +05:30 committed by GitHub
parent d2e990ebf4
commit 07dcdb51f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 90 additions and 8 deletions

View File

@ -83,9 +83,12 @@ services:
otel-collector: otel-collector:
image: signoz-otel-collector:0.55.0 image: signoz-otel-collector:0.55.0
command: ["--config=/etc/otel-collector-config.yaml"] command: ["--config=/etc/otel-collector-config.yaml"]
# user: root # required for reading docker container logs user: root # required for reading docker container logs
volumes: volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
- /var/lib/docker/containers:/var/lib/docker/containers:ro
environment:
- OTEL_RESOURCE_ATTRIBUTES=host.name={{.Node.Hostname}},os.type={{.Node.Platform.OS}},dockerswarm.service.name={{.Service.Name}},dockerswarm.task.name={{.Task.Name}}
ports: ports:
# - "1777:1777" # pprof extension # - "1777:1777" # pprof extension
- "4317:4317" # OTLP gRPC receiver - "4317:4317" # OTLP gRPC receiver
@ -98,11 +101,8 @@ services:
# - "14268:14268" # Jaeger thrift HTTP # - "14268:14268" # Jaeger thrift HTTP
# - "55678:55678" # OpenCensus receiver # - "55678:55678" # OpenCensus receiver
# - "55679:55679" # zPages extension # - "55679:55679" # zPages extension
environment:
- OTEL_RESOURCE_ATTRIBUTES=host.name={{.Node.Hostname}},os.type={{.Node.Platform.OS}},dockerswarm.service.name={{.Service.Name}},dockerswarm.task.name={{.Task.Name}}
deploy: deploy:
mode: replicated mode: global
replicas: 3
restart_policy: restart_policy:
condition: on-failure condition: on-failure
resources: resources:

View File

@ -1,4 +1,29 @@
receivers: receivers:
filelog/dockercontainers:
include: [ "/var/lib/docker/containers/*/*.log" ]
start_at: end
include_file_path: true
include_file_name: false
operators:
- type: json_parser
id: parser-docker
output: extract_metadata_from_filepath
timestamp:
parse_from: attributes.time
layout: '%Y-%m-%dT%H:%M:%S.%LZ'
- type: regex_parser
id: extract_metadata_from_filepath
regex: '^.*containers/(?P<container_id>[^_]+)/.*log$'
parse_from: attributes["log.file.path"]
output: parse_body
- type: move
id: parse_body
from: attributes.log
to: body
output: time
- type: remove
id: time
field: attributes.time
opencensus: opencensus:
endpoint: 0.0.0.0:55678 endpoint: 0.0.0.0:55678
otlp/spanmetrics: otlp/spanmetrics:
@ -117,6 +142,6 @@ service:
receivers: [otlp/spanmetrics] receivers: [otlp/spanmetrics]
exporters: [prometheus] exporters: [prometheus]
logs: logs:
receivers: [otlp] receivers: [otlp, filelog/dockercontainers]
processors: [batch] processors: [batch]
exporters: [clickhouselogsexporter] exporters: [clickhouselogsexporter]

View File

@ -80,9 +80,10 @@ services:
otel-collector: otel-collector:
image: signoz/signoz-otel-collector:0.55.0 image: signoz/signoz-otel-collector:0.55.0
command: ["--config=/etc/otel-collector-config.yaml"] command: ["--config=/etc/otel-collector-config.yaml"]
# user: root # required for reading docker container logs user: root # required for reading docker container logs
volumes: volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
- /var/lib/docker/containers:/var/lib/docker/containers:ro
environment: environment:
- OTEL_RESOURCE_ATTRIBUTES=host.name=signoz-host,os.type=linux - OTEL_RESOURCE_ATTRIBUTES=host.name=signoz-host,os.type=linux
ports: ports:

View File

@ -1,4 +1,29 @@
receivers: receivers:
filelog/dockercontainers:
include: [ "/var/lib/docker/containers/*/*.log" ]
start_at: end
include_file_path: true
include_file_name: false
operators:
- type: json_parser
id: parser-docker
output: extract_metadata_from_filepath
timestamp:
parse_from: attributes.time
layout: '%Y-%m-%dT%H:%M:%S.%LZ'
- type: regex_parser
id: extract_metadata_from_filepath
regex: '^.*containers/(?P<container_id>[^_]+)/.*log$'
parse_from: attributes["log.file.path"]
output: parse_body
- type: move
id: parse_body
from: attributes.log
to: body
output: time
- type: remove
id: time
field: attributes.time
opencensus: opencensus:
endpoint: 0.0.0.0:55678 endpoint: 0.0.0.0:55678
otlp/spanmetrics: otlp/spanmetrics:
@ -121,6 +146,6 @@ service:
receivers: [otlp/spanmetrics] receivers: [otlp/spanmetrics]
exporters: [prometheus] exporters: [prometheus]
logs: logs:
receivers: [otlp] receivers: [otlp, filelog/dockercontainers]
processors: [batch] processors: [batch]
exporters: [clickhouselogsexporter] exporters: [clickhouselogsexporter]

View File

@ -61,8 +61,10 @@ services:
otel-collector: otel-collector:
image: signoz-otel-collector:0.55.0 image: signoz-otel-collector:0.55.0
command: ["--config=/etc/otel-collector-config.yaml"] command: ["--config=/etc/otel-collector-config.yaml"]
user: root # required for reading docker container logs
volumes: volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
- /var/lib/docker/containers:/var/lib/docker/containers:ro
environment: environment:
- OTEL_RESOURCE_ATTRIBUTES=host.name=signoz-host,os.type=linux - OTEL_RESOURCE_ATTRIBUTES=host.name=signoz-host,os.type=linux
ports: ports:

View File

@ -1,4 +1,29 @@
receivers: receivers:
filelog/dockercontainers:
include: [ "/var/lib/docker/containers/*/*.log" ]
start_at: end
include_file_path: true
include_file_name: false
operators:
- type: json_parser
id: parser-docker
output: extract_metadata_from_filepath
timestamp:
parse_from: attributes.time
layout: '%Y-%m-%dT%H:%M:%S.%LZ'
- type: regex_parser
id: extract_metadata_from_filepath
regex: '^.*containers/(?P<container_id>[^_]+)/.*log$'
parse_from: attributes["log.file.path"]
output: parse_body
- type: move
id: parse_body
from: attributes.log
to: body
output: time
- type: remove
id: time
field: attributes.time
opencensus: opencensus:
endpoint: 0.0.0.0:55678 endpoint: 0.0.0.0:55678
otlp/spanmetrics: otlp/spanmetrics:
@ -108,3 +133,7 @@ service:
metrics/spanmetrics: metrics/spanmetrics:
receivers: [otlp/spanmetrics] receivers: [otlp/spanmetrics]
exporters: [prometheus] exporters: [prometheus]
logs:
receivers: [otlp, filelog/dockercontainers]
processors: [batch]
exporters: [clickhouselogsexporter]