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:
Ivana Huckova
2023-05-04 19:33:00 +02:00
committed by GitHub
parent 49ff85ef54
commit 95cf598423
8 changed files with 142 additions and 37 deletions
@@ -28,7 +28,7 @@
"_source": {
"abc": null,
"is_true": true,
"testtime": "2023-02-09T14:40:01.475Z",
"testtime": "09/02/2023",
"line": "log text [106619125]",
"counter": 81,
"float": 10.911972180833306,
@@ -55,6 +55,11 @@
}
}
},
"fields": {
"testtime": [
"2023-02-09T14:40:01.475Z"
]
},
"sort": [
1675953601475,
4
@@ -71,7 +76,7 @@
"_source": {
"abc": null,
"is_true": false,
"testtime": "2023-02-09T14:40:00.513Z",
"testtime": "09/02/2023",
"line": "log text with [781660944]",
"counter": 80,
"float": 62.94120607636795,
@@ -92,6 +97,11 @@
}
}
},
"fields": {
"testtime": [
"2023-02-09T14:40:00.513Z"
]
},
"sort": [
1675953600513,
7
@@ -108,7 +118,7 @@
"_source": {
"abc": "def",
"is_true": true,
"testtime": "2023-02-09T14:39:59.556Z",
"testtime": "09/02/2023",
"line": "log text [894867430]",
"counter": 79,
"float": 53.323706427230455,
@@ -129,6 +139,11 @@
}
}
},
"fields": {
"testtime": [
"2023-02-09T14:39:59.556Z"
]
},
"sort": [
1675953599556,
10
@@ -145,7 +160,7 @@
"_source": {
"abc": "def",
"is_true": false,
"testtime": "2023-02-09T14:39:58.608Z",
"testtime": "09/02/2023",
"line": "log text [478598889]",
"counter": 78,
"float": 82.72012623471589,
@@ -172,6 +187,11 @@
}
}
},
"fields": {
"testtime": [
"2023-02-09T14:39:58.608Z"
]
},
"sort": [
1675953598608,
15
@@ -188,7 +208,7 @@
"_source": {
"abc": "def",
"is_true": false,
"testtime": "2023-02-09T14:39:57.665Z",
"testtime": "09/02/2023",
"line": "log text [526995818]",
"counter": 77,
"float": 35.05784443331803,
@@ -215,6 +235,11 @@
}
}
},
"fields": {
"testtime": [
"2023-02-09T14:39:57.665Z"
]
},
"sort": [
1675953597665,
20