Skip to content

Commit

Permalink
updates to jsons and ndjsons
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Tackett <tackadam@amazon.com>
  • Loading branch information
Adam Tackett committed Oct 10, 2024
1 parent 706e349 commit 2e773bc
Show file tree
Hide file tree
Showing 14 changed files with 181 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export const CollectAndShipData: React.FC<CollectAndShipDataProps> = ({
java: javaJson,
};

useEffect(() => {
handleCollectionMethodChange(cardOne);
}, []);

useEffect(() => {
let isMounted = true;

Expand Down Expand Up @@ -192,11 +196,8 @@ export const CollectAndShipData: React.FC<CollectAndShipDataProps> = ({

return (
<>
<EuiText>
<h3>{collectionMethod}</h3>
</EuiText>
<EuiSpacer size="s" />
<EuiText size="s">Select collector</EuiText>
<EuiText size="s">Select telemetry source</EuiText>
<div style={{ maxWidth: '400px' }}>
<EuiCompressedComboBox
singleSelection={{ asPlainText: true }}
Expand Down Expand Up @@ -272,50 +273,58 @@ export const CollectAndShipData: React.FC<CollectAndShipDataProps> = ({
};

const renderSchema = (schemas: any[]) =>

Check warning on line 275 in public/components/getting_started/components/getting_started_collectData.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
schemas.map((schema, idx) => (
<div key={idx}>
<EuiTitle size="s">
<h3>{schema.type} Schema</h3>
</EuiTitle>
<EuiText>
{schema.description}
<br />
{schema.alias && (
<>
<strong>Alias:</strong> {schema.alias}
<br />
</>
)}
<strong>Index Pattern Name:</strong> {schema['index-pattern-name']}
<br />
{Array.isArray(schema.info) &&
schema.info.map((link: any, linkIdx: number) =>
link && typeof link.url === 'string' ? (
<EuiLink key={linkIdx} href={link.url} target="_blank">
{typeof link.title === 'string' && link.title.trim() !== ''
? link.title
: 'More Info'}
</EuiLink>
) : (
<EuiText color="danger" key={linkIdx}>
Invalid URL
</EuiText>
)
schemas.map((schema, idx) => {
const indexPatternName = schema['index-pattern-name'] || '';

return (
<div key={idx}>
<EuiTitle size="s">
<h3>{schema.type} Schema</h3>
</EuiTitle>
<EuiText>
{schema.description}
<br />
{schema.alias && (
<>
<strong>Alias:</strong> {schema.alias}
<br />
</>
)}
</EuiText>
{schema.content && (
<EuiCodeBlock language="bash" fontSize="m" paddingSize="s" isCopyable>
{schema.content}
</EuiCodeBlock>
)}
{schema['index-template'] && (
<EuiLink href={schema['index-template']} target="_blank">
Index Template
</EuiLink>
)}
<EuiSpacer size="m" />
</div>
));
{indexPatternName && (
<>
<strong>Index Pattern Name:</strong> {indexPatternName}
<br />
</>
)}
{Array.isArray(schema.info) &&
schema.info.map((link: any, linkIdx: number) =>

Check warning on line 300 in public/components/getting_started/components/getting_started_collectData.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
link && typeof link.url === 'string' ? (
<EuiLink key={linkIdx} href={link.url} target="_blank">
{typeof link.title === 'string' && link.title.trim() !== ''
? link.title
: 'More Info'}
</EuiLink>
) : (
<EuiText color="danger" key={linkIdx}>
Invalid URL
</EuiText>
)
)}
</EuiText>
{schema.content && (
<EuiCodeBlock language="bash" fontSize="m" paddingSize="s" isCopyable>
{schema.content}
</EuiCodeBlock>
)}
{schema['index-template'] && (
<EuiLink href={schema['index-template']} target="_blank">
{`${indexPatternName} Index Template`}
</EuiLink>
)}
<EuiSpacer size="m" />
</div>
);
});

const renderIndex = (indexPatterns: any) => (
<>
Expand Down Expand Up @@ -361,29 +370,11 @@ export const CollectAndShipData: React.FC<CollectAndShipDataProps> = ({
const baseUrl = `${window.location.origin}/app`;

const cardData = {
otelLogs: {
title: 'Otel Dashboard',
description: 'Analyze logs with pre-packaged dashboards',
icon: <img src={otelIcon} alt="Otel Icon" className="synopsisIcon" />,
url: `${baseUrl}/integrations#/available/otel-services`,
},
otelMetrics: {
title: 'Otel Dashboard',
description: 'Analyze logs with pre-packaged dashboards',
icon: <img src={otelIcon} alt="Otel Icon" className="synopsisIcon" />,
url: `${baseUrl}/integrations#/available/otel-services`,
},
otelTraces: {
title: 'Otel Dashboard',
description: 'Analyze logs with pre-packaged dashboards',
icon: <img src={otelIcon} alt="Otel Icon" className="synopsisIcon" />,
url: `${baseUrl}/integrations#/available/otel-services`,
},
nginx: {
title: 'Nginx Dashboard',
description: 'Analyze logs with pre-packaged dashboards',
icon: <img src={nginxIcon} alt="Nginx Icon" className="synopsisIcon" />,
url: `${baseUrl}/integrations#/available/nginx`,
url: `${baseUrl}/integrations#/available/nginx/setup`,
},
};

Expand Down Expand Up @@ -429,70 +420,73 @@ export const CollectAndShipData: React.FC<CollectAndShipDataProps> = ({
};

const renderSteps = (workflow: any) => {
const steps = workflow.steps.map((step: any) => ({
title: step.name,
children: (
<div>
<EuiText>{step.description}</EuiText>
{step['input-params'] && step['input-params'].length > 0 && (
<div>
<EuiTitle size="xs">
<h4>Input Parameters:</h4>
</EuiTitle>
{step['input-params'].map((param: any, idx: number) => (
<EuiText key={idx}>
<strong>{param.name}:</strong> {param.description} ({param.type})
</EuiText>
))}
</div>
)}

{Array.isArray(step.info) &&
step.info.map((link: any, linkIndex: number) => {
if (link && typeof link.url === 'string') {
return (
<EuiLink key={linkIndex} href={link.url} target="_blank">
{typeof link.title === 'string' && link.title.trim() !== ''
? link.title
: 'More Info'}
</EuiLink>
);
} else {
return (
<EuiText color="danger" key={linkIndex}>
Invalid URL
const steps = [
{
title: 'Schema',
children: renderSchema(
technologyJsonMap[specificMethod]?.['getting-started']?.schema ||
technologyJsonMap[specificMethod]?.schema ||
[]
),
},
{
title: 'Index Patterns',
children: renderIndex(
technologyJsonMap[specificMethod]?.['getting-started']?.['index-patterns'] ||
technologyJsonMap[specificMethod]?.['index-patterns'] ||
{}
),
},
];

steps.push(
...workflow.steps.map((step: any) => ({
title: step.name,
children: (
<div>
<EuiText>{step.description}</EuiText>
{step['input-params'] && step['input-params'].length > 0 && (
<div>
<EuiTitle size="xs">
<h4>Input Parameters:</h4>
</EuiTitle>
{step['input-params'].map((param: any, idx: number) => (
<EuiText key={idx}>
<strong>{param.name}:</strong> {param.description}
</EuiText>
);
}
})}

{step.content && (
<EuiCodeBlock language="bash" fontSize="m" paddingSize="s" isCopyable>
{step.content}
</EuiCodeBlock>
)}
<EuiSpacer size="m" />
</div>
),
}));

steps.push({
title: 'Schema',
children: renderSchema(
technologyJsonMap[specificMethod]?.['getting-started']?.schema ||
technologyJsonMap[specificMethod]?.schema ||
[]
),
});
))}
</div>
)}

steps.push({
title: 'Index Patterns',
children: renderIndex(
technologyJsonMap[specificMethod]?.['getting-started']?.['index-patterns'] ||
technologyJsonMap[specificMethod]?.['index-patterns'] ||
{}
),
});
{Array.isArray(step.info) &&
step.info.map((link: any, linkIndex: number) => {
if (link && typeof link.url === 'string') {
return (
<EuiLink key={linkIndex} href={link.url} target="_blank">
{typeof link.title === 'string' && link.title.trim() !== ''
? link.title
: 'More Info'}
</EuiLink>
);
} else {
return (
<EuiText color="danger" key={linkIndex}>
Invalid URL
</EuiText>
);
}
})}

{step.content && (
<EuiCodeBlock language="bash" fontSize="m" paddingSize="s" isCopyable>
{step.content}
</EuiCodeBlock>
)}
<EuiSpacer size="m" />
</div>
),
}))
);

steps.push({
title: 'Explore your data',
Expand Down Expand Up @@ -520,9 +514,6 @@ export const CollectAndShipData: React.FC<CollectAndShipDataProps> = ({

return (
<EuiPanel paddingSize="m">
<EuiTitle size="s">
<h3>Ingest data by signal type</h3>
</EuiTitle>
<EuiSpacer size="s" />
<EuiFlexGroup>
<EuiFlexItem>
Expand Down Expand Up @@ -567,9 +558,9 @@ export const CollectAndShipData: React.FC<CollectAndShipDataProps> = ({
<EuiSpacer size="s" />
{tabs.length > 0 && (
<>
<EuiTitle size="m">
<EuiTitle size="s">
<h3>
How to ingest{' '}
Steps to integrate{' '}
{specificMethod.startsWith('otel')
? 'OpenTelemetry'
: specificMethod.charAt(0).toUpperCase() + specificMethod.slice(1)}{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,6 @@
"schema": [
{
"type": "logs",
"info": [
{
"url": "https://opensearch.org/docs/latest/im-plugin/index-templates",
"title": "Index Template Documentation"
}
],
"content": "PUT _index_template/application_logs_template",
"description": "Setup applicative logs index template in the dev console",
"index-template": "https://github.com/opensearch-project/opensearch-catalog/blob/main/integrations/observability/golang_client/schemas/applicative-logs-1.0.0.mapping.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@
"schema": [
{
"type": "logs",
"info": [
{ "url": "https://opensearch.org/docs/latest/im-plugin/index-templates", "title": "Index Template Documentation" }
],
"content": "PUT _index_template/application_logs_template",
"description": "Setup applicative logs index template in the dev console",
"index-template": "https://github.com/opensearch-project/opensearch-catalog/blob/main/integrations/observability/java_client/schemas/applicative-logs-1.0.0.mapping.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
}
],
"description": "Setup Fluent-Bit parser config file parsing Nginx access log fields",
"content": "[PARSER]\n Name apache\n Format regex\n Regex ^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \\[(?<time>[^\\]]*)\\] \"(?<method>\\S+)(?: +(?<path>[^\\\"]*?)(?: +\\S*)?)?\" (?<code>[^ ]*) (?<size>[^ ]*)(?: \"(?<referer>[^\\\"]*)\" \"(?<agent>[^\\\"]*)\")?$\n Time_Key time\n Time_Format %d/%b/%Y:%H:%M:%S %z\n\n[PARSER]\n Name nginx\n Format regex\n Regex ^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \\[(?<time>[^\\]]*)\\] \"(?<method>\\S+)(?: +(?<path>[^\\\"]*?)(?: +\\S*)?)?\" (?<code>[^ ]*) (?<size>[^ ]*)(?: \"(?<referer>[^\\\"]*)\" \"(?<agent>[^\\\"]*)\")\n Time_Key time\n Time_Format %d/%b/%Y:%H:%M:%S %z\n"
"content": "[PARSER]\n Name nginx\n Format regex\n Regex ^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \\[(?<time>[^\\]]*)\\] \"(?<method>\\S+)(?: +(?<path>[^\\\"]*?)(?: +\\S*)?)?\" (?<code>[^ ]*) (?<size>[^ ]*)(?: \"(?<referer>[^\\\"]*)\" \"(?<agent>[^\\\"]*)\")\n Time_Key time\n Time_Format %d/%b/%Y:%H:%M:%S %z\n"
},
{
"name": "Fluent-Bit Log Converter",
Expand Down Expand Up @@ -164,8 +164,8 @@
"description": "Setup Fluent-Bit conf file including logs parsing and OpenSearch access",
"input-params": [
{
"name": "opensearch-node1",
"description": "Opensearch host",
"name": "opensearch-endpoint",
"description": "Opensearch host url",
"type": "host-name"
},
{
Expand All @@ -174,40 +174,20 @@
"type": "index-name"
}
],
"content": "[SERVICE]\n Parsers_File parsers.conf\n\n[INPUT]\n Name forward\n Port 24224\n\n[FILTER]\n Name parser\n Match nginx.access\n Key_Name log\n Parser nginx\n\n[FILTER]\n Name parser\n Match apache.access\n Key_Name log\n Parser apache\n\n[Filter]\n Name lua\n Match *\n Script otel-converter.lua\n call convert_to_otel\n\n[OUTPUT]\n Name opensearch\n Match nginx.access\n Host ${opensearch-node1}\n Port 9200\n Index ${ss4o_logs-nginx-prod}\n Suppress_Type_Name On\n tls On\n tls.verify Off\n HTTP_User admin\n HTTP_Passwd my_%New%_passW0rd!@#\n\n[OUTPUT]\n Name opensearch\n Match apache.access\n Host ${opensearch-node1}\n Port 9200\n Index ${ss4o_logs-nginx-prod}\n Suppress_Type_Name On\n tls On\n tls.verify Off\n HTTP_User admin\n HTTP_Passwd my_%New%_passW0rd!@#\n\n[OUTPUT]\n Name stdout\n Match nginx.access"
"content": "[SERVICE]\n Parsers_File parsers.conf\n\n[INPUT]\n Name forward\n Port 24224\n\n[FILTER]\n Name parser\n Match nginx.access\n Key_Name log\n Parser nginx\n\n[FILTER]\n Name parser\n Match apache.access\n Key_Name log\n Parser apache\n\n[Filter]\n Name lua\n Match *\n Script otel-converter.lua\n call convert_to_otel\n\n[OUTPUT]\n Name opensearch\n Match nginx.access\n Host ${opensearch-endpoint}\n Port 9200\n Index ${ss4o_logs-nginx-prod}\n Suppress_Type_Name On\n tls On\n tls.verify Off\n HTTP_User admin\n HTTP_Passwd my_%New%_passW0rd!@#\n\n[OUTPUT]\n Name opensearch\n Match apache.access\n Host ${opensearch-endpoint}\n Port 9200\n Index ${ss4o_logs-nginx-prod}\n Suppress_Type_Name On\n tls On\n tls.verify Off\n HTTP_User admin\n HTTP_Passwd my_%New%_passW0rd!@#\n\n[OUTPUT]\n Name stdout\n Match nginx.access"
}
]
}
],
"schema": [
{
"type": "http",
"info": [
{
"url": "https://opensearch.org/docs/latest/im-plugin/index-templates",
"title": "Index Template Documentation"
},
{
"url": "https://github.com/opensearch-project/opensearch-catalog/blob/main/docs/schema/observability/Naming-convention.md",
"title": "Naming Convention"
}
],
"content": "PUT _component_template/http",
"description": "Setup simple schema http component template in the dev console",
"index-template": "https://github.com/opensearch-project/opensearch-catalog/blob/main/integrations/observability/nginx/schemas/http-1.0.0.mapping.json"
},
{
"type": "communication",
"info": [
{
"url": "https://opensearch.org/docs/latest/im-plugin/index-templates",
"title": "Index Template Documentation"
},
{
"url": "https://github.com/opensearch-project/opensearch-catalog/blob/main/docs/schema/observability/Naming-convention.md",
"title": "Naming Convention"
}
],
"content": "PUT _component_template/communication",
"description": "Setup simple schema communication component template in the dev console",
"index-template": "https://github.com/opensearch-project/opensearch-catalog/blob/main/integrations/observability/nginx/schemas/communication-1.0.0.mapping.json"
Expand Down
Loading

0 comments on commit 2e773bc

Please sign in to comment.