diff --git a/config.example.toml b/config.example.toml index 15efa60..0fb0aec 100644 --- a/config.example.toml +++ b/config.example.toml @@ -65,3 +65,10 @@ Tag = 'demo' #Tag = "tkt" #URL = "https://redmine.example.com" #BearerToken = "example3f5bb1632f40bde25d315d53bdec83e" +# +#[[graylog]] +#Tag = 'graylog' +#URL = "https://graylog.example.com" +#TimeRange = 600 # query timerange in seconds +#Username = "example3f5bb1632f40bde25d315d53bdec83e" +#Password = "token" \ No newline at end of file diff --git a/pkg/connectors/graylog/connector.go b/pkg/connectors/graylog/connector.go index 79fc9dc..b1f7401 100644 --- a/pkg/connectors/graylog/connector.go +++ b/pkg/connectors/graylog/connector.go @@ -24,8 +24,9 @@ type Connector struct { } type Config struct { - Tag string - Cluster string + Tag string + Cluster string + TimeRange int common.HTTPConfig } @@ -90,13 +91,18 @@ func (c *Connector) String() string { func (c *Connector) collectAlertEvents(ctx context.Context) (eventsSearchResults, error) { // TODO: Use pagination, however, we're unlikely to hit this limit for unresolved alerts + timeRangeSeconds := c.config.TimeRange + if timeRangeSeconds == 0 { + timeRangeSeconds = 600 + } + body := eventsSearchParameters{ Query: "", Page: 1, PerPage: 100, TimeRange: timeRange{ Type: TimeRangeRelative, - Range: 600, + Range: timeRangeSeconds, }, }