Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ffd8772
feat: enable log forwarding through otel collector
florentianayuwono Apr 22, 2026
14514f2
chore(deps): update dependency packaging to v26.1 (#180)
renovate[bot] Apr 18, 2026
77f12cf
chore(deps): update dependency sphinx-ubuntu-images to v0.2.0 (#181)
renovate[bot] Apr 18, 2026
f41fd56
chore(deps): replace astral-sh/setup-uv action with astral-sh/setup-u…
renovate[bot] Apr 19, 2026
11631ad
fix(deps): update module github.com/jackc/pgx/v5 to v5.9.2 (#183)
renovate[bot] Apr 19, 2026
b2cff4d
fix(dashboard): remove dead override hiding job queue time series (#184)
cbartz Apr 22, 2026
564ff2c
chore: update Copilot collections to v0.11.0 (#172)
github-actions[bot] Apr 22, 2026
7b44fd0
chore(docs): update contributing guidelines (charmkeeper) (#170)
erinecon Apr 22, 2026
5961c47
Merge branch 'main' into feat/log-forwarding-isd-5146
florentianayuwono Apr 22, 2026
1bdb99d
fix: run shell as bash
florentianayuwono Apr 22, 2026
32eb82f
Update docs/how-to/enable-log-forwarding.md
florentianayuwono Apr 23, 2026
f7f4147
Apply suggestions from code review
florentianayuwono Apr 23, 2026
0539529
fix docs
florentianayuwono Apr 23, 2026
16a1ff7
add index
florentianayuwono Apr 23, 2026
9934f4e
Update actions/enable-log-forwarding/enable-log-forwarding.py
florentianayuwono Apr 23, 2026
8337420
Update actions/enable-log-forwarding/enable-log-forwarding.py
florentianayuwono Apr 23, 2026
9590fd5
Merge branch 'main' into feat/log-forwarding-isd-5146
florentianayuwono Apr 23, 2026
3f3fd59
address code reviews
florentianayuwono Apr 23, 2026
f15564a
add license
florentianayuwono Apr 23, 2026
bc2a1e4
fix docs
florentianayuwono Apr 24, 2026
5016dcb
refactor code
florentianayuwono Apr 24, 2026
a920d9a
Apply suggestions from code review
florentianayuwono Apr 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/enable_log_forwarding_action_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Enable Log Forwarding Action Tests

on:
pull_request:
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
action: ${{ steps.filter.outputs.action }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
action:
- 'actions/enable_log_forwarding/**'
- '.github/workflows/enable_log_forwarding_action_tests.yaml'

test-action:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.action == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Set up uv
uses: astral-sh/setup-uv@v8.1.0

- name: Install tox
run: uv tool install tox --with tox-uv

- name: Run lint, static checks, and unit tests
run: tox -e actions-lint,actions-static,actions-unit

smoke-test-self-hosted:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.action == 'true' }}
runs-on: [self-hosted-linux-amd64-noble-edge]
Comment thread
yanksyoon marked this conversation as resolved.
env:
TEST_CONFIG_FILE: 98-enable-log-forwarding-smoke-${{ github.run_id }}-${{ github.run_attempt }}.yaml
Comment thread
yanksyoon marked this conversation as resolved.
steps:
- uses: actions/checkout@v6

- name: Run enable log forwarding action
uses: ./actions/enable_log_forwarding
with:
files: |
/var/log/syslog
config-file-name: ${{ env.TEST_CONFIG_FILE }}
otlp-endpoint: 127.0.0.1:4317

- name: Verify generated config file exists
run: |
sudo test -f /etc/otelcol/config.d/${TEST_CONFIG_FILE}

- name: Verify generated config contains expected receiver
run: |
sudo grep -q '"filelog/github_runner_optin"' /etc/otelcol/config.d/${TEST_CONFIG_FILE}
33 changes: 33 additions & 0 deletions actions/enable_log_forwarding/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.
name: Enable log forwarding
description: Opt in to forward selected log files from a self-hosted GitHub runner to Loki.

inputs:
files:
description: |
Newline or comma separated list of file paths or glob patterns to forward.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick, avoid double "or", so
Newline, comma separated list of file paths or

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading the code, we support Comma separated, or list separated AND globbing. So you can have multiple globbing

Example: /var/log/chrony/*.log
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provide an example for each supported content (newline, comma separated, and glob)

required: true
otlp-endpoint:
description: |
Optional OTLP/gRPC endpoint for upstream OpenTelemetry Collector logs export.
When not set, the action falls back to ACTION_OTEL_EXPORTER_OTLP_ENDPOINT.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be more specific about where this env var comes from like:
injected automatically by self-hosted github runners provided in Canonical

Example: otel-gateway.internal:4317
required: false
default: ""
config-file-name:
description: File name for the generated collector fragment.
Comment on lines +19 to +20
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be specific about the usecase, renaming might helpful for priority mainly if they want this file to be evaluated before or after some other rules

required: false
default: 90-github-runner-log-forwarding.yaml
Comment thread
yanksyoon marked this conversation as resolved.

runs:
using: composite
steps:
- name: Configure collector for opt-in file log forwarding
shell: bash
env:
INPUT_FILES: ${{ inputs.files }}
INPUT_OTLP_ENDPOINT: ${{ inputs.otlp-endpoint }}
INPUT_CONFIG_FILE_NAME: ${{ inputs.config-file-name }}
run: python3 "${{ github.action_path }}/enable_log_forwarding.py"
23 changes: 23 additions & 0 deletions actions/enable_log_forwarding/collector_config.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"receivers": {
"filelog/github_runner_optin": {
"include": {{ include_files }},
"start_at": "end"
}
},
{{ exporters_section }}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do a test to see if it won't cause a conflict if the exporter is not optional and there are two config files has the same exporter

"processors": {
"resource/github_runner_optin": {
"attributes": {{ resource_attributes }}
}
},
"service": {
"pipelines": {
"logs/github_runner_optin": {
"receivers": ["filelog/github_runner_optin"],
"processors": ["resource/github_runner_optin", "batch"],
"exporters": [{{ exporter_name }}]
}
}
}
}
Loading
Loading