add support for --since in journalctl DSN (#917)
This commit is contained in:
parent
ff0fb50032
commit
b5d0d56a11
2 changed files with 6 additions and 0 deletions
|
@ -215,6 +215,8 @@ func (j *JournalCtlSource) ConfigureByDSN(dsn string, labelType string, logger *
|
|||
return errors.Wrapf(err, "unknown level %s", value[0])
|
||||
}
|
||||
j.logger.Logger.SetLevel(lvl)
|
||||
case "since":
|
||||
j.args = append(j.args, "--since", value[0])
|
||||
default:
|
||||
return fmt.Errorf("unsupported key %s in journalctl DSN", key)
|
||||
}
|
||||
|
|
|
@ -82,6 +82,10 @@ func TestConfigureDSN(t *testing.T) {
|
|||
dsn: "journalctl://filters=_UID=1000&log_level=foobar",
|
||||
expectedErr: "unknown level foobar: not a valid logrus Level:",
|
||||
},
|
||||
{
|
||||
dsn: "journalctl://filters=_UID=1000&log_level=warn&since=yesterday",
|
||||
expectedErr: "",
|
||||
},
|
||||
}
|
||||
subLogger := log.WithFields(log.Fields{
|
||||
"type": "journalctl",
|
||||
|
|
Loading…
Reference in a new issue