Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
a8d913bf
Commit
a8d913bf
authored
Jan 07, 2016
by
Minhan Xia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not fail when parsing unexpected log line
parent
c3d400f4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
+18
-10
es_cluster_logging.go
test/e2e/es_cluster_logging.go
+18
-10
No files found.
test/e2e/es_cluster_logging.go
View file @
a8d913bf
...
@@ -305,7 +305,7 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
...
@@ -305,7 +305,7 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
totalMissing
:=
0
totalMissing
:=
0
expected
:=
nodeCount
*
countTo
expected
:=
nodeCount
*
countTo
missingPerNode
:=
[]
int
{}
missingPerNode
:=
[]
int
{}
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
ingestionTimeout
;
time
.
Sleep
(
10
*
time
.
Second
)
{
for
start
:=
time
.
Now
();
time
.
Since
(
start
)
<
ingestionTimeout
;
time
.
Sleep
(
25
*
time
.
Second
)
{
// Debugging code to report the status of the elasticsearch logging endpoints.
// Debugging code to report the status of the elasticsearch logging endpoints.
selector
:=
labels
.
Set
{
k8sAppKey
:
esValue
}
.
AsSelector
()
selector
:=
labels
.
Set
{
k8sAppKey
:
esValue
}
.
AsSelector
()
...
@@ -372,33 +372,41 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
...
@@ -372,33 +372,41 @@ func ClusterLevelLoggingWithElasticsearch(f *Framework) {
for
_
,
e
:=
range
h
{
for
_
,
e
:=
range
h
{
l
,
ok
:=
e
.
(
map
[
string
]
interface
{})
l
,
ok
:=
e
.
(
map
[
string
]
interface
{})
if
!
ok
{
if
!
ok
{
Failf
(
"element of hit not of expected type: %T"
,
e
)
Logf
(
"element of hit not of expected type: %T"
,
e
)
continue
}
}
source
,
ok
:=
l
[
"_source"
]
.
(
map
[
string
]
interface
{})
source
,
ok
:=
l
[
"_source"
]
.
(
map
[
string
]
interface
{})
if
!
ok
{
if
!
ok
{
Failf
(
"_source not of the expected type: %T"
,
l
[
"_source"
])
Logf
(
"_source not of the expected type: %T"
,
l
[
"_source"
])
continue
}
}
msg
,
ok
:=
source
[
"log"
]
.
(
string
)
msg
,
ok
:=
source
[
"log"
]
.
(
string
)
if
!
ok
{
if
!
ok
{
Failf
(
"log not of the expected type: %T"
,
source
[
"log"
])
Logf
(
"log not of the expected type: %T"
,
source
[
"log"
])
continue
}
}
words
:=
strings
.
Split
(
msg
,
" "
)
words
:=
strings
.
Split
(
msg
,
" "
)
if
len
(
words
)
<
4
{
if
len
(
words
)
!=
4
{
Failf
(
"Malformed log line: %s"
,
msg
)
Logf
(
"Malformed log line: %s"
,
msg
)
continue
}
}
n
,
err
:=
strconv
.
ParseUint
(
words
[
0
],
10
,
0
)
n
,
err
:=
strconv
.
ParseUint
(
words
[
0
],
10
,
0
)
if
err
!=
nil
{
if
err
!=
nil
{
Failf
(
"Expecting numer of node as first field of %s"
,
msg
)
Logf
(
"Expecting numer of node as first field of %s"
,
msg
)
continue
}
}
if
n
<
0
||
int
(
n
)
>=
nodeCount
{
if
n
<
0
||
int
(
n
)
>=
nodeCount
{
Failf
(
"Node count index out of range: %d"
,
nodeCount
)
Logf
(
"Node count index out of range: %d"
,
nodeCount
)
continue
}
}
index
,
err
:=
strconv
.
ParseUint
(
words
[
2
],
10
,
0
)
index
,
err
:=
strconv
.
ParseUint
(
words
[
2
],
10
,
0
)
if
err
!=
nil
{
if
err
!=
nil
{
Failf
(
"Expecting number as third field of %s"
,
msg
)
Logf
(
"Expecting number as third field of %s"
,
msg
)
continue
}
}
if
index
<
0
||
index
>=
countTo
{
if
index
<
0
||
index
>=
countTo
{
Failf
(
"Index value out of range: %d"
,
index
)
Logf
(
"Index value out of range: %d"
,
index
)
continue
}
}
// Record the observation of a log line from node n at the given index.
// Record the observation of a log line from node n at the given index.
observed
[
n
][
index
]
++
observed
[
n
][
index
]
++
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment