Cleanup logs in kinesis output (#5328)

This commit is contained in:
Greg 2019-01-22 15:05:20 -07:00 committed by Daniel Nelson
parent 739aeeb2e0
commit 5b85569316
1 changed files with 7 additions and 7 deletions

View File

@ -124,7 +124,7 @@ func (k *KinesisOutput) Connect() error {
// We attempt first to create a session to Kinesis using an IAMS role, if that fails it will fall through to using
// environment variables, and then Shared Credentials.
if k.Debug {
log.Printf("E! kinesis: Establishing a connection to Kinesis in %+v", k.Region)
log.Printf("I! kinesis: Establishing a connection to Kinesis in %s", k.Region)
}
credentialConfig := &internalaws.CredentialConfig{
@ -165,14 +165,14 @@ func writekinesis(k *KinesisOutput, r []*kinesis.PutRecordsRequestEntry) time.Du
if k.Debug {
resp, err := k.svc.PutRecords(payload)
if err != nil {
log.Printf("E! kinesis: Unable to write to Kinesis : %+v \n", err.Error())
log.Printf("E! kinesis: Unable to write to Kinesis : %s", err.Error())
}
log.Printf("E! %+v \n", resp)
log.Printf("I! Wrote: '%+v'", resp)
} else {
_, err := k.svc.PutRecords(payload)
if err != nil {
log.Printf("E! kinesis: Unable to write to Kinesis : %+v \n", err.Error())
log.Printf("E! kinesis: Unable to write to Kinesis : %s", err.Error())
}
}
return time.Since(start)
@ -197,7 +197,7 @@ func (k *KinesisOutput) getPartitionKey(metric telegraf.Metric) string {
// Default partition name if default is not set
return "telegraf"
default:
log.Printf("E! kinesis : You have configured a Partition method of %+v which is not supported", k.Partition.Method)
log.Printf("E! kinesis : You have configured a Partition method of '%s' which is not supported", k.Partition.Method)
}
}
if k.RandomPartitionKey {
@ -236,7 +236,7 @@ func (k *KinesisOutput) Write(metrics []telegraf.Metric) error {
if sz == 500 {
// Max Messages Per PutRecordRequest is 500
elapsed := writekinesis(k, r)
log.Printf("E! Wrote a %+v point batch to Kinesis in %+v.\n", sz, elapsed)
log.Printf("I! Wrote a %d point batch to Kinesis in %+v.", sz, elapsed)
sz = 0
r = nil
}
@ -244,7 +244,7 @@ func (k *KinesisOutput) Write(metrics []telegraf.Metric) error {
}
if sz > 0 {
elapsed := writekinesis(k, r)
log.Printf("E! Wrote a %+v point batch to Kinesis in %+v.\n", sz, elapsed)
log.Printf("I! Wrote a %d point batch to Kinesis in %+v.", sz, elapsed)
}
return nil