The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/plugins/datasource/elasticsearch/configuration/LogsConfig.tsx

61 lines
1.7 KiB

import React from 'react';
import { ConfigDescriptionLink, ConfigSubSection } from '@grafana/experimental';
import { Input, InlineField } from '@grafana/ui';
import { ElasticsearchOptions } from '../types';
type Props = {
value: ElasticsearchOptions;
onChange: (value: ElasticsearchOptions) => void;
};
export const LogsConfig = (props: Props) => {
const { value, onChange } = props;
const changeHandler =
(key: keyof ElasticsearchOptions) => (event: React.SyntheticEvent<HTMLInputElement | HTMLSelectElement>) => {
onChange({
...value,
[key]: event.currentTarget.value,
});
};
return (
<ConfigSubSection
title="Logs"
description={
<ConfigDescriptionLink
description="Configure which fields the data source uses for log messages and log levels."
suffix="elasticsearch/#logs"
feature="Elasticsearch log fields"
/>
}
>
<InlineField
label="Message field name"
labelWidth={22}
tooltip="Configure the field to be used for log messages."
>
<Input
id="es_logs-config_logMessageField"
value={value.logMessageField}
onChange={changeHandler('logMessageField')}
placeholder="_source"
width={24}
/>
</InlineField>
<InlineField
label="Level field name"
labelWidth={22}
tooltip="Configure the field that determines the level of each log message."
>
<Input
id="es_logs-config_logLevelField"
value={value.logLevelField}
onChange={changeHandler('logLevelField')}
width={24}
/>
</InlineField>
</ConfigSubSection>
);
};