Cleanup logs in kinesis output (#5328)
This commit is contained in:
parent
739aeeb2e0
commit
5b85569316
|
@ -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
|
// 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.
|
// environment variables, and then Shared Credentials.
|
||||||
if k.Debug {
|
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{
|
credentialConfig := &internalaws.CredentialConfig{
|
||||||
|
@ -165,14 +165,14 @@ func writekinesis(k *KinesisOutput, r []*kinesis.PutRecordsRequestEntry) time.Du
|
||||||
if k.Debug {
|
if k.Debug {
|
||||||
resp, err := k.svc.PutRecords(payload)
|
resp, err := k.svc.PutRecords(payload)
|
||||||
if err != nil {
|
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 {
|
} else {
|
||||||
_, err := k.svc.PutRecords(payload)
|
_, err := k.svc.PutRecords(payload)
|
||||||
if err != nil {
|
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)
|
return time.Since(start)
|
||||||
|
@ -197,7 +197,7 @@ func (k *KinesisOutput) getPartitionKey(metric telegraf.Metric) string {
|
||||||
// Default partition name if default is not set
|
// Default partition name if default is not set
|
||||||
return "telegraf"
|
return "telegraf"
|
||||||
default:
|
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 {
|
if k.RandomPartitionKey {
|
||||||
|
@ -236,7 +236,7 @@ func (k *KinesisOutput) Write(metrics []telegraf.Metric) error {
|
||||||
if sz == 500 {
|
if sz == 500 {
|
||||||
// Max Messages Per PutRecordRequest is 500
|
// Max Messages Per PutRecordRequest is 500
|
||||||
elapsed := writekinesis(k, r)
|
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
|
sz = 0
|
||||||
r = nil
|
r = nil
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ func (k *KinesisOutput) Write(metrics []telegraf.Metric) error {
|
||||||
}
|
}
|
||||||
if sz > 0 {
|
if sz > 0 {
|
||||||
elapsed := writekinesis(k, r)
|
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
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue