Skip to content

Commit

Permalink
add tag to exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
rucciva committed Jul 12, 2023
1 parent f65b8bb commit 7be29e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var maxFetchRange = strToDurationOrDefault(os.Getenv("HWC_LOGSTREAM_MAX_FETCH_RA
var minFetchRange = strToDurationOrDefault(os.Getenv("HWC_LOGSTREAM_MIN_FETCH_RANGE"), time.Minute)
var streamRoutine = int(strToIntOrDefault(os.Getenv("HWC_LOGSTREAM_ROUTINE"), 5))
var streamPosTag = envOrDefault("HWC_LOGSTREAM_POSITITION_TAG", "x-hwc-logstream-pos")
var streamExclusionTag = envOrDefault("HWC_LOGSTREAM_EXCLUSION_TAG", "x-hwc-logstream-exclude")

func envOrDefault(name, def string) string {
v, ok := os.LookupEnv(name)
Expand Down
5 changes: 5 additions & 0 deletions manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ func (m LogstreamManager) SyncStreamList(ctx context.Context) (err error) {
}

for _, stream := range *streams.LogStreams {
if _, ok := stream.Tag[streamExclusionTag]; ok {
log.Printf("[INFO] stream '%s' of group '%s' is excluded.\n", group.LogGroupName, stream.LogStreamName)
continue
}

s := NewLogstream(m.client, group, stream, stdout)
fetched[s.ID()] = struct{}{}
if v, ok := m.streams[s.ID()]; !ok {
Expand Down

0 comments on commit 7be29e6

Please sign in to comment.