mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Elasticsearch: Fix processing of logs with not-recognized time format (#67767)
* Elasticsearch: Fix parsing of invalid time * Fix lint * Add more test data to data.js * Add tests * Fix lint * Update pkg/tsdb/elasticsearch/client/search_request.go
This commit is contained in:
@@ -64,6 +64,18 @@ async function elasticSetupIndexTemplate() {
|
||||
'@timestamp': {
|
||||
type: 'date',
|
||||
},
|
||||
'@timestamp_custom': {
|
||||
type: 'date',
|
||||
format: 'yyyy_MM_dd_HH_mm_ss'
|
||||
},
|
||||
'@timestamp_unix': {
|
||||
type: 'date',
|
||||
format: 'epoch_millis'
|
||||
},
|
||||
'@timestamp_nanos': {
|
||||
type: 'date_nanos',
|
||||
format: 'strict_date_optional_time_nanos'
|
||||
},
|
||||
counter: {
|
||||
type: 'integer',
|
||||
},
|
||||
@@ -115,6 +127,9 @@ function getRandomLogItem(counter, timestamp) {
|
||||
const maybeAnsiText = Math.random() < 0.5 ? 'with ANSI \u001b[31mpart of the text\u001b[0m' : '';
|
||||
return {
|
||||
'@timestamp': timestamp.toISOString(),
|
||||
'@timestamp_custom': timestamp.toISOString().split('.')[0].replace(/[T:-]/g,'_'),
|
||||
'@timestamp_unix': timestamp.getTime(),
|
||||
'@timestamp_nanos': timestamp.toISOString().slice(0,-1) + '123Z',
|
||||
line: `log text ${maybeAnsiText} [${randomText}]`,
|
||||
counter: counter.toString(),
|
||||
float: 100 * Math.random().toString(),
|
||||
|
||||
Reference in New Issue
Block a user