Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCP stackdriver producer #257

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 6 additions & 5 deletions core/simpleconsumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@
package core

import (
"github.com/trivago/tgo/ttesting"
"testing"
"time"

"github.com/trivago/tgo/ttesting"
)

func getSimpleConsumer(mockConf PluginConfig) (SimpleConsumer, error) {
simpleConsumer := SimpleConsumer{
//control: make(chan PluginControl),
//runState: new(PluginRunState),
//modulators: ModulatorArray{},
//Logger: logrus.WithField("Scope", "test"),
//control: make(chan PluginControl),
//runState: new(PluginRunState),
//modulators: ModulatorArray{},
//Logger: logrus.WithField("Scope", "test"),
}

reader := NewPluginConfigReader(&mockConf)
Expand Down
1 change: 1 addition & 0 deletions docs/src/gen/producer/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
/src/gen/producer/scribe.rst
/src/gen/producer/socket.rst
/src/gen/producer/spooling.rst
/src/gen/producer/stackdriver.rst
/src/gen/producer/statsdmetrics.rst
/src/gen/producer/websocket.rst
154 changes: 154 additions & 0 deletions docs/src/gen/producer/stackdriver.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
.. Autogenerated by Gollum RST generator (docs/generator/*.go)

Stackdriver
===========

The Stackdriver producer forwards messages to stackdriver logging.
The payload of each message will be passed as log message. This should ideally
be a JSON encoded string.




Parameters
----------

**Enable** (default: true)

Switches this plugin on or off.


**ProjectID**

The google cloud project id storing the logs. This parameter
is required to be set to a non-empty string.



**Payload**

The name of the metadata field to store as payload. This can be a
string or a subtree, which will be encoded as JSON. If no value is set, the
message payload will be passed as string.
By default this is setting is set to "".



**Severity**

If set, this denotes a metadata field containing a valid severity
string. Valid, case sensitive strings are "Default", "Debug", "Info", "Notice",
"Warning", "Error", "Critical", "Alert" and "Emergency". If a value fails to be
parsed "Default" is used. If the metadata field is not existing or "" is used,
the value of DefaultSeverity is used.
By default this is setting is set to "".



**DefaultSeverity** (default: Default)

The severity to use if no severity is set or parsing of the
Severity metadata field failed. By default this is set to "Default".



**LogName**

Defines a mapping between stream name and log name. If not set,
the stream name will be used as a log name. By default no mapping is set.



**Labels**

An array of metadata keys, that should be extracted from each message
and used as a label. If a key is not available for a single message, the label
will still be set with an empty string as value.
By default this is set to an empty array.



Parameters (from core.BufferedProducer)
---------------------------------------

**Channel**

This value defines the capacity of the message buffer.
By default this parameter is set to "8192".



**ChannelTimeoutMs** (default: 0, unit: ms)

This value defines a timeout for each message
before the message will discarded. To disable the timeout, set this
parameter to 0.
By default this parameter is set to "0".



Parameters (from core.SimpleProducer)
-------------------------------------

**Streams**

Defines a list of streams the producer will receive from. This
parameter is mandatory. Specifying "*" causes the producer to receive messages
from all streams except internal internal ones (e.g. _GOLLUM_).
By default this parameter is set to an empty list.



**FallbackStream**

Defines a stream to route messages to if delivery fails.
The message is reset to its original state before being routed, i.e. all
modifications done to the message after leaving the consumer are removed.
Setting this paramater to "" will cause messages to be discared when delivery
fails.



**ShutdownTimeoutMs** (default: 1000, unit: ms)

Defines the maximum time in milliseconds a producer is
allowed to take to shut down. After this timeout the producer is always
considered to have shut down. Decreasing this value may lead to lost
messages during shutdown. Raising it may increase shutdown time.



**Modulators**

Defines a list of modulators to be applied to a message when
it arrives at this producer. If a modulator changes the stream of a message
the message is NOT routed to this stream anymore.
By default this parameter is set to an empty list.



Examples
--------

.. code-block:: yaml

StackdriverOut:
Type: producer.Stackdriver
Streams: mylogs
ProjectID: my-gcp-project-id
Payload: "message"
Severity: "severity"
DefaultSeverity: "Error"

LogName:
.. code-block:: yaml

"mylogs": "errorlog"
Labels:
- "hostname"
- "service"





7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module github.com/trivago/gollum

require (
cloud.google.com/go/logging v1.0.0
github.com/CrowdStrike/go-metrics-prometheus v0.0.0-20190206080537-f2bb39ee2c39
github.com/MeteoGroup/go-metrics-prometheus v0.0.0-20170102121754-1d412ec2ed4f // indirect
github.com/Shopify/sarama v1.17.0
Expand All @@ -21,7 +22,7 @@ require (
github.com/eapache/queue v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.4.7
github.com/go-redis/redis v6.14.0+incompatible
github.com/golang/protobuf v1.2.0
github.com/golang/protobuf v1.3.2
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/gorilla/websocket v1.3.0
github.com/mattn/go-colorable v0.0.9 // indirect
Expand All @@ -45,9 +46,7 @@ require (
github.com/trivago/tgo v1.0.7
github.com/x-cray/logrus-prefixed-formatter v0.5.2
go.uber.org/automaxprocs v1.2.0
golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d // indirect
golang.org/x/sys v0.0.0-20180828065106-d99a578cf41b // indirect
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5
gopkg.in/mcuadros/go-syslog.v2 v2.2.1
gopkg.in/olivere/elastic.v5 v5.0.74
gopkg.in/oschwald/geoip2-golang.v1 v1.2.1
Expand Down
Loading