Skip to content

Commit db80623

Browse files
authored
Name change and bug fix (#27)
* update plugin name to offical name * fix timeout issue for event batching
1 parent 9c82e8e commit db80623

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
.git
2-
splunk-log-plugin
2+
splunk-logging-plugin

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
splunk-log-plugin
2-
splunk-log-plugin.tar.gz
1+
splunk-logging-plugin
2+
splunk-logging-plugin.tar.gz
33
.idea/
44
.DS_Store
55
*.pyc

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
FROM golang:1.9.2
22

3-
WORKDIR /go/src/github.com/splunk/splunk-log-plugin/
3+
WORKDIR /go/src/github.com/splunk/splunk-logging-plugin/
44

5-
COPY . /go/src/github.com/splunk/splunk-log-plugin/
5+
COPY . /go/src/github.com/splunk/splunk-logging-plugin/
66

77

8-
RUN cd /go/src/github.com/splunk/splunk-log-plugin && go get
8+
RUN cd /go/src/github.com/splunk/splunk-logging-plugin && go get
99

10-
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /bin/splunk-log-plugin .
10+
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /bin/splunk-logging-plugin .
1111

1212
FROM alpine:3.7
1313
RUN apk --no-cache add ca-certificates
14-
COPY --from=0 /bin/splunk-log-plugin /bin/
14+
COPY --from=0 /bin/splunk-logging-plugin /bin/
1515
WORKDIR /bin/
16-
ENTRYPOINT [ "/bin/splunk-log-plugin" ]
16+
ENTRYPOINT [ "/bin/splunk-logging-plugin" ]

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
PLUGIN_NAME=splunk-log-plugin
1+
PLUGIN_NAME=splunk/docker-logging-plugin
22
PLUGIN_TAG=latest
3-
PLUGIN_DIR=./splunk-log-plugin
3+
PLUGIN_DIR=./splunk-logging-plugin
44

55
all: clean docker rootfs create
66
package: clean docker rootfs zip
@@ -10,7 +10,7 @@ clean:
1010
rm -rf ${PLUGIN_DIR}
1111

1212
docker:
13-
@echo "### docker build: rootfs image with splunk-log-plugin"
13+
@echo "### docker build: rootfs image with splunk-logging-plugin"
1414
docker build -t ${PLUGIN_NAME}:rootfs .
1515

1616
rootfs:

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"description": "Splunk Logging Plugin",
33
"documentation": "https://github.com/splunk/docker-logging-plugin",
4-
"entrypoint": ["/bin/splunk-log-plugin"],
4+
"entrypoint": ["/bin/splunk-logging-plugin"],
55
"network": {
66
"type": "host"
77
},

splunk_logger.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,13 +490,14 @@ Do a HEC POST when
490490
- time out
491491
*/
492492
func (l *splunkLogger) worker() {
493-
timer := time.NewTicker(l.hec.postMessagesFrequency)
494493
var messages []*splunkMessage
495494
for {
495+
timer := time.NewTicker(l.hec.postMessagesFrequency)
496496
select {
497497
case message, open := <-l.stream:
498498
// if the stream channel is closed, post the remaining messages in the buffer
499499
if !open {
500+
logrus.Debugf("stream is closed with %d events", len(messages))
500501
l.hec.postMessages(messages, true)
501502
l.lock.Lock()
502503
defer l.lock.Unlock()
@@ -513,6 +514,7 @@ func (l *splunkLogger) worker() {
513514
messages = l.hec.postMessages(messages, false)
514515
}
515516
case <-timer.C:
517+
logrus.Debugf("messages buffer timeout, sending %d events", len(messages))
516518
messages = l.hec.postMessages(messages, false)
517519
}
518520
}

0 commit comments

Comments
 (0)