Skip to content

Commit

Permalink
Merge branch 'main' into salvacorts/bloom-refactor/planner-progress-t…
Browse files Browse the repository at this point in the history
…racking
  • Loading branch information
salvacorts committed Jun 20, 2024
2 parents 3caf83d + 1d6f8d5 commit 5f8edd7
Show file tree
Hide file tree
Showing 479 changed files with 163,280 additions and 8,257 deletions.
2 changes: 1 addition & 1 deletion .github/jsonnetfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"subdir": "workflows"
}
},
"version": "124c4d996f9625478a79f1884465e29ea082d224"
"version": "adca1c07a2199374e1646e62331926509699368b"
}
],
"legacyImports": true
Expand Down
4 changes: 2 additions & 2 deletions .github/jsonnetfile.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"subdir": "workflows"
}
},
"version": "124c4d996f9625478a79f1884465e29ea082d224",
"sum": "8wrJURq48ZBAtZcReO1W7AiXmvUyLqb932Q9sXyfFVo="
"version": "adca1c07a2199374e1646e62331926509699368b",
"sum": "/6NMt3DFr1mpaBxncbwBJVV5vBpAMIyP3XNOoFArz5Q="
}
],
"legacyImports": false
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
- name: "download images"
run: |
echo "downloading images to $(pwd)/images"
gsutil cp -r gs://loki-build-artifacts/${{ needs.createRelease.outputs.sha }}/images .
gsutil cp -r gs://${BUILD_ARTIFACTS_BUCKET}/${{ needs.createRelease.outputs.sha }}/images .
- name: "publish docker images"
uses: "./lib/actions/push-images"
with:
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
".": "3.0.0",
"operator": "0.6.0"
"operator": "0.6.1"
}
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,13 @@ release-workflows:

.PHONY: release-workflows-check
release-workflows-check:
ifeq ($(BUILD_IN_CONTAINER),true)
$(SUDO) docker run $(RM) $(TTY) -i \
-v $(shell go env GOPATH)/pkg:/go/pkg$(MOUNT_FLAGS) \
-v $(shell pwd):/src/loki$(MOUNT_FLAGS) \
$(IMAGE_PREFIX)/loki-build-image:$(BUILD_IMAGE_VERSION) $@;
else
@$(MAKE) release-workflows
@echo "Checking diff"
@git diff --exit-code -- ".github/workflows/*release*" || (echo "Please build release workflows by running 'make release-workflows'" && false)
endif
1 change: 1 addition & 0 deletions clients/cmd/promtail/promtail-local-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ scrape_configs:
labels:
job: varlogs
__path__: /var/log/*log
stream: stdout
17 changes: 17 additions & 0 deletions clients/pkg/promtail/scrapeconfig/scrapeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ type JournalTargetConfig struct {
Matches string `yaml:"matches"`
}

type SyslogFormat string

const (
// A modern Syslog RFC
SyslogFormatRFC5424 = "rfc5424"
// A legacy Syslog RFC also known as BSD-syslog
SyslogFormatRFC3164 = "rfc3164"
)

// SyslogTargetConfig describes a scrape config that listens for log lines over syslog.
type SyslogTargetConfig struct {
// ListenAddress is the address to listen on for syslog messages.
Expand Down Expand Up @@ -202,12 +211,20 @@ type SyslogTargetConfig struct {
// message should be pushed to Loki
UseRFC5424Message bool `yaml:"use_rfc5424_message"`

// Syslog format used at the target. Acceptable value is rfc5424 or rfc3164.
// Default is rfc5424.
SyslogFormat SyslogFormat `yaml:"syslog_format"`

// MaxMessageLength sets the maximum limit to the length of syslog messages
MaxMessageLength int `yaml:"max_message_length"`

TLSConfig promconfig.TLSConfig `yaml:"tls_config,omitempty"`
}

func (config SyslogTargetConfig) IsRFC3164Message() bool {
return config.SyslogFormat == SyslogFormatRFC3164
}

// WindowsEventsTargetConfig describes a scrape config that listen for windows event logs.
type WindowsEventsTargetConfig struct {

Expand Down
20 changes: 14 additions & 6 deletions clients/pkg/promtail/targets/syslog/syslogparser/syslogparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
"fmt"
"io"

"github.com/influxdata/go-syslog/v3"
"github.com/influxdata/go-syslog/v3/nontransparent"
"github.com/influxdata/go-syslog/v3/octetcounting"
"github.com/leodido/go-syslog/v4"
"github.com/leodido/go-syslog/v4/nontransparent"
"github.com/leodido/go-syslog/v4/octetcounting"
)

// ParseStream parses a rfc5424 syslog stream from the given Reader, calling
// the callback function with the parsed messages. The parser automatically
// detects octet counting.
// The function returns on EOF or unrecoverable errors.
func ParseStream(r io.Reader, callback func(res *syslog.Result), maxMessageLength int) error {
func ParseStream(isRFC3164Message bool, r io.Reader, callback func(res *syslog.Result), maxMessageLength int) error {
buf := bufio.NewReaderSize(r, 1<<10)

b, err := buf.ReadByte()
Expand All @@ -24,9 +24,17 @@ func ParseStream(r io.Reader, callback func(res *syslog.Result), maxMessageLengt
_ = buf.UnreadByte()

if b == '<' {
nontransparent.NewParser(syslog.WithListener(callback), syslog.WithMaxMessageLength(maxMessageLength), syslog.WithBestEffort()).Parse(buf)
if isRFC3164Message {
nontransparent.NewParserRFC3164(syslog.WithListener(callback), syslog.WithMaxMessageLength(maxMessageLength), syslog.WithBestEffort()).Parse(buf)
} else {
nontransparent.NewParser(syslog.WithListener(callback), syslog.WithMaxMessageLength(maxMessageLength), syslog.WithBestEffort()).Parse(buf)
}
} else if b >= '0' && b <= '9' {
octetcounting.NewParser(syslog.WithListener(callback), syslog.WithMaxMessageLength(maxMessageLength), syslog.WithBestEffort()).Parse(buf)
if isRFC3164Message {
octetcounting.NewParserRFC3164(syslog.WithListener(callback), syslog.WithMaxMessageLength(maxMessageLength), syslog.WithBestEffort()).Parse(buf)
} else {
octetcounting.NewParser(syslog.WithListener(callback), syslog.WithMaxMessageLength(maxMessageLength), syslog.WithBestEffort()).Parse(buf)
}
} else {
return fmt.Errorf("invalid or unsupported framing. first byte: '%s'", string(b))
}
Expand Down
Loading

0 comments on commit 5f8edd7

Please sign in to comment.