-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Loki Log Streaming #1385
Open
amanji
wants to merge
18
commits into
main
Choose a base branch
from
bcgov/feature/loki-log-streaming
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Loki Log Streaming #1385
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
59cb815
feat: docker compose config for promtail, grafana and loki services
amanji 61ee803
feat: websocket package
amanji 803955d
feat: API websocket support
amanji d43478b
update: vscode settings
amanji bfddbb0
feat: add jwonwebtoken package
amanji 504056f
feat: API websocket token authentication
amanji bbe6591
feat: log store and component
amanji da4c622
chore: update test snapshots
amanji 19b03fc
chore: suppress unrelated ts build error
amanji 592789b
chore: parameterize URLs
amanji 86fb430
Merge branch 'main' into bcgov/feature/loki-log-streaming
amanji 48818a4
chore: suppress unrelated ts build error
amanji 8ba3e44
Merge remote-tracking branch 'upstream/main' into bcgov/feature/loki-…
amanji 2a94893
chore: audit and update dependencies
amanji f3729c7
chore: update env variables
amanji 200cdd5
Merge remote-tracking branch 'upstream/main' into bcgov/feature/loki-…
amanji 57edbcf
update: chart values
amanji 155a340
update: chart values
amanji File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
server: | ||
http_listen_address: 0.0.0.0 | ||
http_listen_port: 9080 | ||
|
||
positions: | ||
filename: /tmp/positions.yaml | ||
|
||
clients: | ||
- url: http://loki:3100/loki/api/v1/push | ||
|
||
scrape_configs: | ||
- job_name: system | ||
static_configs: | ||
- targets: | ||
- localhost | ||
labels: | ||
job: varlogs | ||
__path__: /var/log/*log | ||
|
||
- job_name: journal | ||
journal: | ||
json: false | ||
max_age: 12h | ||
path: /var/log/journal | ||
# matches: _syslog_identifier=dockerd | ||
labels: | ||
job: systemd-journal | ||
relabel_configs: | ||
- source_labels: | ||
- __journal__systemd_unit | ||
target_label: systemd_unit | ||
- source_labels: | ||
- __journal__hostname | ||
target_label: hostname | ||
- source_labels: | ||
- __journal_syslog_identifier | ||
target_label: syslog_identifier | ||
- source_labels: | ||
- __journal__transport | ||
target_label: transport | ||
|
||
- job_name: containers | ||
static_configs: | ||
- targets: | ||
- localhost | ||
labels: | ||
job: containerlogs | ||
__path__: /var/lib/docker/containers/*/*log | ||
|
||
# --log-opt tag="{{.Name}}" | ||
pipeline_stages: | ||
|
||
- json: | ||
expressions: | ||
stream: stream | ||
attrs: attrs | ||
tag: attrs.tag | ||
|
||
- regex: | ||
expression: (?P<container_name>(?:[^|]*[^|])) | ||
source: "tag" | ||
|
||
- labels: | ||
tag: | ||
stream: | ||
container_name: | ||
|
||
- job_name: flog_scrape | ||
docker_sd_configs: | ||
- host: unix:///var/run/docker.sock | ||
refresh_interval: 5s | ||
filters: | ||
- name: name | ||
values: [flog] | ||
relabel_configs: | ||
- source_labels: ['__meta_docker_container_name'] | ||
regex: '/(.*)\.[0-9]\..*' | ||
target_label: 'name' | ||
- source_labels: ['__meta_docker_container_name'] | ||
regex: '/(.*)\.[0-9a-z]*\..*' | ||
target_label: 'name' | ||
- source_labels: ['__meta_docker_container_name'] | ||
regex: '/.*\.([0-9]{1,2})\..*' | ||
target_label: 'replica' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
version: "3.9" | ||
|
||
x-logging: &default-logging | ||
driver: loki | ||
options: | ||
loki-url: http://localhost:3100/loki/api/v1/push | ||
loki-retries: 5 | ||
loki-batch-size: 400 | ||
|
||
services: | ||
loki: | ||
image: grafana/loki:2.9.2 | ||
ports: | ||
- "3100:3100" | ||
command: -config.file=/etc/loki/local-config.yaml | ||
logging: *default-logging | ||
networks: | ||
- loki | ||
|
||
promtail: | ||
image: grafana/promtail:2.9.2 | ||
volumes: | ||
- /var/log:/var/log | ||
- /var/lib/docker/containers:/var/lib/docker/containers | ||
- ./configs/promtail.yml:/etc/promtail/config.yml | ||
command: -config.file=/etc/promtail/config.yml | ||
networks: | ||
- loki | ||
|
||
grafana: | ||
environment: | ||
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning | ||
- GF_AUTH_ANONYMOUS_ENABLED=true | ||
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin | ||
logging: *default-logging | ||
entrypoint: | ||
- sh | ||
- -euc | ||
- | | ||
mkdir -p /etc/grafana/provisioning/datasources | ||
cat <<EOF > /etc/grafana/provisioning/datasources/ds.yaml | ||
apiVersion: 1 | ||
datasources: | ||
- name: Loki | ||
type: loki | ||
access: proxy | ||
orgId: 1 | ||
url: http://loki:3100 | ||
basicAuth: false | ||
isDefault: true | ||
version: 1 | ||
editable: false | ||
EOF | ||
/run.sh | ||
image: grafana/grafana:latest | ||
ports: | ||
- "3000:3000" | ||
networks: | ||
- loki | ||
|
||
networks: | ||
loki: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These
envvars
need to be added to the chart as wellThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See chart if its correct.