You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONFIG.md
+46-2Lines changed: 46 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ The `retention_check_interval` is the interval at which `grok_exporter` checks f
56
56
Input Section
57
57
-------------
58
58
59
-
We currently support two input types: `file`and `stdin`. The following two sections describe the `file` input type and the `stdin` input type:
59
+
We currently support three input types: `file`, `stdin`, and `webhook`. The following three sections describe the input types respectively:
60
60
61
61
### File Input Type
62
62
@@ -114,6 +114,50 @@ the exporter will terminate as soon as `sample.log` is processed,
114
114
and we will not be able to access the result via HTTP(S) after that.
115
115
Always use a command that keeps the output open (like `tail -f`) when testing the `grok_exporter` with the `stdin` input.
116
116
117
+
### Webhook Input Type
118
+
119
+
The grok_exporter is capable of receive log entries from webhook sources. It supports webhook reception in various formats... plain-text or JSON, single entries or bulk entries.
120
+
121
+
The following input configuration example which demonstrates how to configure grok_exporter to receive HTTP webhooks from the [Logstash HTTP Output Plugin](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-http.html) configured in `json_batch` mode, which allows the transmission of multiple json log entries in a single webhook.
122
+
123
+
```yaml
124
+
input:
125
+
126
+
type: webhook
127
+
128
+
# HTTP Path to POST the webhook
129
+
# Default is `/webhook`
130
+
webhook_path: /webhook
131
+
132
+
# HTTP Body POST Format
133
+
# text_single: Webhook POST body is a single plain text log entry
134
+
# text_bulk: Webhook POST body contains multiple plain text log entries
135
+
# separated by webhook_text_bulk_separator (default: \n\n)
136
+
# json_single: Webhook POST body is a single json log entry. Log entry
137
+
# text is selected from the value of a json key determined by
138
+
# webhook_json_selector.
139
+
# json_bulk: Webhook POST body contains multiple json log entries. The
140
+
# POST body envelope must be a json array "[ <entry>, <entry> ]". Log
141
+
# entry text is selected from the value of a json key determined by
142
+
# webhook_json_selector.
143
+
# Default is `text_single`
144
+
webhook_format: json_bulk
145
+
146
+
# JSON Path Selector
147
+
# Within an json log entry, text is selected from the value of this json selector
148
+
# Example ".path.to.element"
149
+
# Default is `.message`
150
+
webhook_json_selector: .message
151
+
152
+
# Bulk Text Separator
153
+
# Separator for text_bulk log entries
154
+
# Default is `\n\n`
155
+
webhook_text_bulk_separator: "\n\n"
156
+
```
157
+
158
+
This configuration example may be found in the examples directory
* `protocol` can be `http` or `https`. Default is `http`.
414
-
* `host` can be a hostname or an IP address. If host is specified, `grok_exporter` will listen on the network interface with the given address. If host is omitted, `grok_exporter` will listen on all available network interfaces.
458
+
* `host` can be a hostname or an IP address. If host is specified, `grok_exporter` will listen on the network interface with the given address. If host is omitted, `grok_exporter` will listen on all available network interfaces. If `host` is set to `[::]`, `grok_exporter` will listen on all IPV6 addresses.
415
459
* `port` is the TCP port to be used. Default is `9144`.
416
460
* `path` is the path where the metrics are exposed. Default is `/metrics`, i.e. by default metrics will be exported on [http://localhost:9144/metrics].
417
461
* `cert` is the path to the SSL certificate file for protocol `https`. It is optional. If omitted, a hard-coded default certificate will be used.
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ server:
54
54
port: 9144
55
55
```
56
56
57
-
[CONFIG.md] describes the `grok_exporter` configuration file and shows how to define Grok patterns, Prometheus metrics, and labels.
57
+
[CONFIG.md] describes the `grok_exporter` configuration file and shows how to define Grok patterns, Prometheus metrics, and labels. It also details how to configure file, stdin, and webhook inputs.
returnfmt.Errorf("invalid input configuration: 'input.webhook_text_bulk_separator' is required for input type \"webhook\" and webhook_format \"text_bulk\"")
0 commit comments