Document and add support to input plugins for logging alias (#6357)

This commit is contained in:
Greg
2019-09-23 16:39:50 -06:00
committed by Daniel Nelson
parent e42d2e39c6
commit 817c9a69a9
111 changed files with 961 additions and 659 deletions

View File

@@ -6,7 +6,6 @@ import (
"bytes"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
@@ -23,6 +22,8 @@ type Processes struct {
execPS func() ([]byte, error)
readProcFile func(filename string) ([]byte, error)
Log telegraf.Logger
forcePS bool
forceProc bool
}
@@ -124,8 +125,7 @@ func (p *Processes) gatherFromPS(fields map[string]interface{}) error {
case '?':
fields["unknown"] = fields["unknown"].(int64) + int64(1)
default:
log.Printf("I! processes: Unknown state [ %s ] from ps",
string(status[0]))
p.Log.Infof("Unknown state %q from ps", string(status[0]))
}
fields["total"] = fields["total"].(int64) + int64(1)
}
@@ -184,14 +184,13 @@ func (p *Processes) gatherFromProc(fields map[string]interface{}) error {
}
fields["parked"] = int64(1)
default:
log.Printf("I! processes: Unknown state [ %s ] in file %s",
string(stats[0][0]), filename)
p.Log.Infof("Unknown state %q in file %q", string(stats[0][0]), filename)
}
fields["total"] = fields["total"].(int64) + int64(1)
threads, err := strconv.Atoi(string(stats[17]))
if err != nil {
log.Printf("I! processes: Error parsing thread count: %s", err)
p.Log.Infof("Error parsing thread count: %s", err.Error())
continue
}
fields["total_threads"] = fields["total_threads"].(int64) + int64(threads)