Skip to content

Commit fc3814d

Browse files
[Infra] Update LogStream component docs (#100795) (#100872)
1 parent 9f19a64 commit fc3814d

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

x-pack/plugins/infra/public/components/log_stream/log_stream.stories.mdx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const Template = (args) => <LogStream {...args} />;
113113

114114
The purpose of this component is to allow you, the developer, to have your very own Log Stream in your plugin.
115115

116-
The component is exposed through `infra/public`. Since Kibana uses relative paths is up to you to find how to import it (sorry).
116+
The component is exposed through `infra/public`. Since Kibana uses relative paths, it is up to you to find how to import it (sorry).
117117

118118
```tsx
119119
import { LogStream } from '../../../../../../infra/public';
@@ -124,8 +124,9 @@ import { LogStream } from '../../../../../../infra/public';
124124

125125
To use the component your plugin needs to follow certain criteria:
126126

127-
- Ensure `"infra"` is specified as a `requiredPlugins` in your plugin's `kibana.json`.
128-
- Ensure the `<LogStream />` component is mounted inside the hiearchy of a [`kibana-react` provider](https://github.com/elastic/kibana/blob/b2d0aa7b7fae1c89c8f9e8854ae73e71be64e765/src/plugins/kibana_react/README.md#L45).
127+
- Ensure `"infra"` and `"data"` are specified as a `requiredPlugins` in your plugin's `kibana.json`.
128+
- Ensure the `<LogStream />` component is mounted inside the hierachy of a [`kibana-react` provider](https://github.com/elastic/kibana/blob/b2d0aa7b7fae1c89c8f9e8854ae73e71be64e765/src/plugins/kibana_react/README.md#L45). At a minimum, the kibana-react provider must pass `http` (from core start services) and `data` (from core plugin start dependencies).
129+
- Ensure the `<LogStream />` component is mounted inside the hierachy of a [`EuiThemeProvider`](https://github.com/elastic/kibana/blob/master/src/plugins/kibana_react/common/eui_styled_components.tsx).
129130

130131
## Usage
131132

@@ -354,25 +355,30 @@ The infra plugin has the concept of a "source configuration", a collection of se
354355
The `<LogStream />` component will use the `"default"` source configuration. If you want to use your own configuration, you need to first create it when you initialize your plugin, and then specify it in the `<LogStream />` component with the `sourceId` prop.
355356

356357
```tsx
357-
// Your `plugin/init.ts`
358+
// Your `server/plugin.ts`
358359
class MyPlugin {
359360
// ...
360361
setup(core, plugins) {
361362
plugins.infra.defineInternalSourceConfiguration(
362363
'my_source', // ID for your source configuration
363364
{
364-
logAlias: 'some-index-*', // Optional. what ES index to query.
365+
name: 'some-name',
366+
description: 'some description',
367+
logIndices: { // Also accepts an `index_pattern` type with `indexPatternId`
368+
type: 'index_name',
369+
indexName: 'some-index',
370+
},
365371
logColumns: [
366-
{ timestampColumn: { id: '...uuid4' }, // The `@timestamp` column.
367-
{ fieldColumn: { id: '...uuid4', field: 'some_field' }}, // Any column(s) you want.
368-
{ messageColumn: { id: '...uuid' }} // The `message` column.
372+
{ timestampColumn: { id: '...uuid4' }, // The `@timestamp` column. `id` is an arbitrary string identifier.
373+
{ fieldColumn: { id: '...uuid4', field: 'some_field' }}, // Any column(s) you want. `id` is an arbitrary string identifier.
374+
{ messageColumn: { id: '...uuid' }} // The `message` column. `id` is an arbitrary string identifier.
369375
]
370376
}
371377
);
372378
}
373379
}
374380

375-
// Somewhere else on your code
381+
// Somewhere else in your client-side code
376382
<LogStream
377383
sourceId="my_source"
378384
startTimestamp={...}

0 commit comments

Comments
 (0)