Skip to content

Commit e805050

Browse files
adding examples to http source of data prepper (#11347) (#11485)
1 parent e06bc6d commit e805050

File tree

1 file changed

+101
-7
lines changed
  • _data-prepper/pipelines/configuration/sources

1 file changed

+101
-7
lines changed

_data-prepper/pipelines/configuration/sources/http.md

Lines changed: 101 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ max_connection_count | No | Integer | The maximum allowed number of open connect
2424
max_pending_requests | No | Integer | The maximum allowed number of tasks in the `ScheduledThreadPool` work queue. Default value is `1024`.
2525
max_request_length | No | ByteCount | The maximum number of bytes allowed in the payload of a single HTTP request. Default value is `10mb`.
2626
authentication | No | Object | An authentication configuration. By default, this creates an unauthenticated server for the pipeline. This uses pluggable authentication for HTTPS. To use basic authentication define the `http_basic` plugin with a `username` and `password`. To provide customer authentication, use or create a plugin that implements [ArmeriaHttpAuthenticationProvider](https://github.com/opensearch-project/data-prepper/blob/1.2.0/data-prepper-plugins/armeria-common/src/main/java/com/amazon/dataprepper/armeria/authentication/ArmeriaHttpAuthenticationProvider.java).
27-
ssl | No | Boolean | Enables TLS/SSL. Default value is false.
28-
ssl_certificate_file | Conditionally | String | SSL certificate chain file path or Amazon Simple Storage Service (Amazon S3) path. Amazon S3 path example `s3://<bucketName>/<path>`. Required if `ssl` is set to true and `use_acm_certificate_for_ssl` is set to false.
29-
ssl_key_file | Conditionally | String | SSL key file path or Amazon S3 path. Amazon S3 path example `s3://<bucketName>/<path>`. Required if `ssl` is set to true and `use_acm_certificate_for_ssl` is set to false.
30-
use_acm_certificate_for_ssl | No | Boolean | Enables a TLS/SSL using certificate and private key from AWS Certificate Manager (ACM). Default value is false.
27+
ssl | No | Boolean | Enables TLS/SSL. Default value is `false`.
28+
ssl_certificate_file | Conditionally | String | The SSL certificate chain file path or Amazon Simple Storage Service (Amazon S3) path (for example, `s3://<bucketName>/<path>`). Required if `ssl` is set to `true` and `use_acm_certificate_for_ssl` is set to `false`.
29+
ssl_key_file | Conditionally | String | The SSL key file path or Amazon S3 path (for example, `s3://<bucketName>/<path>`). Required if `ssl` is set to `true` and `use_acm_certificate_for_ssl` is set to `false`.
30+
use_acm_certificate_for_ssl | No | Boolean | Enables TLS/SSL using the certificate and private key from AWS Certificate Manager (ACM). Default is `false`.
3131
acm_certificate_arn | Conditionally | String | The ACM certificate Amazon Resource Name (ARN). The ACM certificate takes preference over Amazon S3 or a local file system certificate. Required if `use_acm_certificate_for_ssl` is set to true.
3232
acm_private_key_password | No | String | ACM private key password that decrypts the private key. If not provided, Data Prepper generates a random password.
3333
acm_certificate_timeout_millis | No | Integer | Timeout, in milliseconds, that ACM takes to get certificates. Default value is 120000.
@@ -43,12 +43,106 @@ Clients should send HTTP `POST` requests to the endpoint `/log/ingest`.
4343

4444
The `http` protocol only supports the JSON UTF-8 codec for incoming requests, for example, `[{"key1": "value1"}, {"key2": "value2"}]`.
4545

46-
#### Example: Ingest data with cURL
46+
## Example
4747

48-
The following cURL command can be used to ingest data:
48+
The following examples demonstrate different configurations that can be used with the `http` source.
4949

50+
### Minimal HTTP source
51+
52+
The following is the minimal configuration using all default values:
53+
54+
```yaml
55+
minimal-http-pipeline:
56+
source:
57+
http:
58+
sink:
59+
- stdout: {}
60+
```
61+
{% include copy.html %}
62+
63+
You can test this pipeline using the following command:
64+
65+
```bash
66+
curl -s "http://localhost:2021/log/ingest" \
67+
-H "Content-Type: application/json" \
68+
--data '[{"msg":"one"},{"msg":"two"}]'
69+
```
70+
{% include copy.html %}
71+
72+
You should see the following output in the Data Prepper logs:
73+
74+
```
75+
{"msg":"one"}
76+
{"msg":"two"}
77+
```
78+
79+
### Custom path using the pipeline name and health check
80+
81+
The following example uses a custom path, configures a custom port, and enables health checks:
82+
83+
```yaml
84+
audit-pipeline:
85+
source:
86+
http:
87+
port: 2022
88+
path: "/${pipelineName}/logs" # -> /audit-pipeline/logs
89+
health_check_service: true
90+
unauthenticated_health_check: true
91+
sink:
92+
- stdout: {}
5093
```
51-
curl "http://localhost:2021/log/ingest" --data '[{"key1": "value1"}, {"key2": "value2"}]'
94+
{% include copy.html %}
95+
96+
You can use the following command to check the pipeline health:
97+
98+
```bash
99+
curl -s "http://localhost:2022/health"
100+
```
101+
{% include copy.html %}
102+
103+
You can ingest data using the following command:
104+
105+
```bash
106+
curl -s "http://localhost:2022/audit-pipeline/logs" \
107+
-H "Content-Type: application/json" \
108+
--data '[{"event":"login","user":"alice"}]'
109+
```
110+
{% include copy.html %}
111+
112+
### Basic authentication on the source
113+
114+
The following example configures a custom port and path, enables health checks, and configures basic authentication:
115+
116+
```yaml
117+
secure-intake-pipeline:
118+
source:
119+
http:
120+
port: 2023
121+
path: /ingest
122+
authentication:
123+
http_basic:
124+
username: ingest
125+
password: s3cr3t
126+
health_check_service: true
127+
unauthenticated_health_check: true
128+
sink:
129+
- stdout: {}
130+
- opensearch:
131+
hosts: ["https://opensearch:9200"]
132+
insecure: true
133+
username: admin
134+
password: admin_password
135+
index_type: custom
136+
index: demo-%{yyyy.MM.dd}
137+
```
138+
{% include copy.html %}
139+
140+
You can test this pipeline using the following command:
141+
142+
```bash
143+
curl -s -u ingest:s3cr3t "http://localhost:2023/ingest" \
144+
-H "Content-Type: application/json" \
145+
--data '[{"service":"web","status":"ok"}]'
52146
```
53147
{% include copy.html %}
54148

0 commit comments

Comments
 (0)