Skip to content

Commit 6e06a6b

Browse files
Copilotflash1293
authored andcommitted
[Streams] Add curl/HTTP example to Logs Stream onboarding (elastic#241073)
Adds a curl/HTTP tab to the Streams Settings flyout onboarding, providing users with a direct HTTP example for ingesting logs via the `_bulk` API. ## Changes - Added curl/HTTP as fifth shipper option alongside OTel, Filebeat, Logstash, and Fleet - Added descriptive text above the curl code block explaining how to use the Bulk API, with a link to the Elasticsearch Bulk API documentation - Added NDJSON bulk API example showing two log ingestion patterns: - Structured format with nested `body` and `resource.attributes` - Flat format with top-level `message` and `host.name` - Configured JSON syntax highlighting for curl/HTTP tab (other tabs remain YAML) ```typescript // Example displayed in curl/HTTP tab POST /logs/_bulk { "create": {} } { "@timestamp": "2025-05-05T12:12:12", "body": { "text": "Hello world!" }, "resource": { "attributes": { "host.name": "my-host-name" } } } { "create": {} } { "@timestamp": "2025-05-05T12:12:12", "message": "Hello world!", "host.name": "my-host-name" } ``` Aligns with <a href="https://github.com/elastic/docs-content/pull/3683">docs-content#3683</a>. Fixes elastic#241059 <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>[Streams] Add curl example to Logs Stream onboarding</issue_title> > <issue_description>similar to the docs change, let's add one tab with the same curl snippet: > > elastic/docs-content#3683 > > <img width="1410" height="1322" alt="Image" src="https://github.com/user-attachments/assets/0995ec98-0c65-49bb-8eff-bce7b836d071" /></issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > <comment_new><author>@elasticmachine</author><body> > Pinging @elastic/obs-ux-logs-team (Team:obs-ux-logs)</body></comment_new> > <comment_new><author>@flash1293</author><body> > The tabs in `x-pack/platform/plugins/shared/streams_app/public/components/stream_list_view/streams_settings_flyout.tsx` need to be extended for this. The tab should be called `curl`, the content should be > > ``` > POST /logs/_bulk > { "create": {} } > { "@timestamp": "2025-05-05T12:12:12", "body": { "text": "Hello world!" }, "resource": { "attributes": { "host.name": "my-host-name" } } } > { "create": {} } > { "@timestamp": "2025-05-05T12:12:12", "message": "Hello world!", "host.name": "my-host-name" } > ```</body></comment_new> > </comments> > </details> - Fixes elastic#241059 <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: flash1293 <[email protected]>
1 parent 2be9750 commit 6e06a6b

File tree

1 file changed

+42
-8
lines changed

1 file changed

+42
-8
lines changed

x-pack/platform/plugins/shared/streams_app/public/components/stream_list_view/streams_settings_flyout.tsx

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ export function StreamsSettingsFlyout({
145145
id: `${shipperButtonGroupPrefix}__fleet`,
146146
label: 'Fleet',
147147
},
148+
{
149+
id: `${shipperButtonGroupPrefix}__curl`,
150+
label: 'curl/HTTP',
151+
},
148152
];
149153
const [selectedShipperId, setSelectedShipperId] = React.useState(
150154
`${shipperButtonGroupPrefix}__otel`
@@ -188,6 +192,11 @@ output.elasticsearch:
188192
action => "create"
189193
}
190194
}`,
195+
[`${shipperButtonGroupPrefix}__curl`]: `POST /logs/_bulk
196+
{ "create": {} }
197+
{ "@timestamp": "2025-05-05T12:12:12", "body": { "text": "Hello world!" }, "resource": { "attributes": { "host.name": "my-host-name" } } }
198+
{ "create": {} }
199+
{ "@timestamp": "2025-05-05T12:12:12", "message": "Hello world!", "host.name": "my-host-name" }`,
191200
};
192201

193202
return (
@@ -352,14 +361,39 @@ output.elasticsearch:
352361
</ul>
353362
</EuiText>
354363
) : (
355-
<EuiCodeBlock
356-
language="yaml"
357-
isCopyable
358-
paddingSize="m"
359-
data-test-subj="streamsShipperConfigExample"
360-
>
361-
{shipperConfigExamples[selectedShipperId]}
362-
</EuiCodeBlock>
364+
<>
365+
{selectedShipperId.endsWith('__curl') && (
366+
<EuiText size="s">
367+
<p>
368+
<FormattedMessage
369+
id="xpack.streams.streamsListView.shipperConfigCurlDescription"
370+
defaultMessage="Send data to the {logsEndpoint} endpoint using the {bulkApiLink}. Refer to the following example for more information:"
371+
values={{
372+
logsEndpoint: <code>/logs/</code>,
373+
bulkApiLink: (
374+
<EuiLink
375+
href="https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk"
376+
target="_blank"
377+
rel="noopener noreferrer"
378+
external
379+
>
380+
Bulk API
381+
</EuiLink>
382+
),
383+
}}
384+
/>
385+
</p>
386+
</EuiText>
387+
)}
388+
<EuiCodeBlock
389+
language={selectedShipperId.endsWith('__curl') ? 'json' : 'yaml'}
390+
isCopyable
391+
paddingSize="m"
392+
data-test-subj="streamsShipperConfigExample"
393+
>
394+
{shipperConfigExamples[selectedShipperId]}
395+
</EuiCodeBlock>
396+
</>
363397
)}
364398
</EuiFlexGroup>
365399
</EuiFlyoutBody>

0 commit comments

Comments
 (0)