Skip to content

Commit aebfab6

Browse files
Merge pull request #469 from hhromic/syslog-ctrname-split
adapters/syslog: add ContainerNameSplitN utility message function
2 parents 62b3e8b + 1c346e3 commit aebfab6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

adapters/syslog/syslog.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,8 @@ func (m *Message) Timestamp() string {
267267
func (m *Message) ContainerName() string {
268268
return m.Message.Container.Name[1:]
269269
}
270+
271+
// ContainerNameSplitN returns the message's container name sliced at most "n" times using "sep"
272+
func (m *Message) ContainerNameSplitN(sep string, n int) []string {
273+
return strings.SplitN(m.ContainerName(), sep, n)
274+
}

0 commit comments

Comments
 (0)