Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference/auditbeat/add-nomad-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Indexers and matchers are used to correlate fields in events with actual metadat

Indexers use allocation metadata to create unique identifiers for each one of the pods.

Avaliable indexers are:
Available indexers are:

`allocation_name`
: Identifies allocations by its name and namespace (as `<namespace>/<name>`)
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/auditbeat/configuration-ssl.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Controls the verification of server certificates. Valid values are:

### `ca_trusted_fingerprint` [ca_trusted_fingerprint]

A HEX encoded SHA-256 of a CA certificate. If this certificate is present in the chain during the handshake, it will be added to the `certificate_authorities` list and the handshake will continue normaly.
A HEX encoded SHA-256 of a CA certificate. If this certificate is present in the chain during the handshake, it will be added to the `certificate_authorities` list and the handshake will continue normally.

To get the fingerprint from a CA certificate on a Unix-like system, you can use the following command, where `ca.crt` is the certificate.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/filebeat/add-nomad-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Indexers and matchers are used to correlate fields in events with actual metadat

Indexers use allocation metadata to create unique identifiers for each one of the pods.

Avaliable indexers are:
Available indexers are:

`allocation_name`
: Identifies allocations by its name and namespace (as `<namespace>/<name>`)
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/filebeat/configuration-ssl.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Controls the verification of server certificates. Valid values are:

### `ca_trusted_fingerprint` [ca_trusted_fingerprint]

A HEX encoded SHA-256 of a CA certificate. If this certificate is present in the chain during the handshake, it will be added to the `certificate_authorities` list and the handshake will continue normaly.
A HEX encoded SHA-256 of a CA certificate. If this certificate is present in the chain during the handshake, it will be added to the `certificate_authorities` list and the handshake will continue normally.

To get the fingerprint from a CA certificate on a Unix-like system, you can use the following command, where `ca.crt` is the certificate.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/filebeat/filebeat-input-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Valid encodings:
* `ebcdic-1040`: IBM CodePage 1140
* `ebcdic-1047`: IBM CodePage 1047
* `koi8r`: KOI8-R, Russian (Cyrillic)
* `koi8u`: KOI8-U, Ukranian (Cyrillic)
* `koi8u`: KOI8-U, Ukrainian (Cyrillic)
* `macintosh`: Macintosh encoding
* `macintosh-cyrillic`: Macintosh Cyrillic encoding
* `windows1250`: Windows1250, Central and Eastern European
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/filebeat/filebeat-input-filestream.md
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ Valid encodings:
* `ebcdic-1040`: IBM CodePage 1140
* `ebcdic-1047`: IBM CodePage 1047
* `koi8r`: KOI8-R, Russian (Cyrillic)
* `koi8u`: KOI8-U, Ukranian (Cyrillic)
* `koi8u`: KOI8-U, Ukrainian (Cyrillic)
* `macintosh`: Macintosh encoding
* `macintosh-cyrillic`: Macintosh Cyrillic encoding
* `windows1250`: Windows1250, Central and Eastern European
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/filebeat/filebeat-input-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Valid encodings:
* `ebcdic-1040`: IBM CodePage 1140
* `ebcdic-1047`: IBM CodePage 1047
* `koi8r`: KOI8-R, Russian (Cyrillic)
* `koi8u`: KOI8-U, Ukranian (Cyrillic)
* `koi8u`: KOI8-U, Ukrainian (Cyrillic)
* `macintosh`: Macintosh encoding
* `macintosh-cyrillic`: Macintosh Cyrillic encoding
* `windows1250`: Windows1250, Central and Eastern European
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/filebeat/filebeat-input-stdin.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Valid encodings:
* `ebcdic-1040`: IBM CodePage 1140
* `ebcdic-1047`: IBM CodePage 1047
* `koi8r`: KOI8-R, Russian (Cyrillic)
* `koi8u`: KOI8-U, Ukranian (Cyrillic)
* `koi8u`: KOI8-U, Ukrainian (Cyrillic)
* `macintosh`: Macintosh encoding
* `macintosh-cyrillic`: Macintosh Cyrillic encoding
* `windows1250`: Windows1250, Central and Eastern European
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/heartbeat/add-nomad-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Indexers and matchers are used to correlate fields in events with actual metadat

Indexers use allocation metadata to create unique identifiers for each one of the pods.

Avaliable indexers are:
Available indexers are:

`allocation_name`
: Identifies allocations by its name and namespace (as `<namespace>/<name>`)
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/heartbeat/configuration-ssl.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ Controls the verification of server certificates. Valid values are:

### `ca_trusted_fingerprint` [ca_trusted_fingerprint]

A HEX encoded SHA-256 of a CA certificate. If this certificate is present in the chain during the handshake, it will be added to the `certificate_authorities` list and the handshake will continue normaly.
A HEX encoded SHA-256 of a CA certificate. If this certificate is present in the chain during the handshake, it will be added to the `certificate_authorities` list and the handshake will continue normally.

To get the fingerprint from a CA certificate on a Unix-like system, you can use the following command, where `ca.crt` is the certificate.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/metricbeat/add-nomad-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Indexers and matchers are used to correlate fields in events with actual metadat

Indexers use allocation metadata to create unique identifiers for each one of the pods.

Avaliable indexers are:
Available indexers are:

`allocation_name`
: Identifies allocations by its name and namespace (as `<namespace>/<name>`)
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/metricbeat/configuration-ssl.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Controls the verification of server certificates. Valid values are:

### `ca_trusted_fingerprint` [ca_trusted_fingerprint]

A HEX encoded SHA-256 of a CA certificate. If this certificate is present in the chain during the handshake, it will be added to the `certificate_authorities` list and the handshake will continue normaly.
A HEX encoded SHA-256 of a CA certificate. If this certificate is present in the chain during the handshake, it will be added to the `certificate_authorities` list and the handshake will continue normally.

To get the fingerprint from a CA certificate on a Unix-like system, you can use the following command, where `ca.crt` is the certificate.

Expand Down
22 changes: 11 additions & 11 deletions docs/reference/metricbeat/exported-fields-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,31 +179,31 @@


**`system.core.model_number`**
: CPU model number. Only availabe on Linux
: CPU model number. Only available on Linux

type: keyword


**`system.core.model_name`**
: CPU model name. Only availabe on Linux
: CPU model name. Only available on Linux

type: keyword


**`system.core.mhz`**
: CPU core current clock. Only availabe on Linux
: CPU core current clock. Only available on Linux

type: float


**`system.core.core_id`**
: CPU physical core ID. One core might might execute multiple threads, hence more than one `system.core.id` can share the same `system.core.core_id`. Only availabe on Linux
: CPU physical core ID. One core might execute multiple threads, hence more than one `system.core.id` can share the same `system.core.core_id`. Only available on Linux

Check notice on line 200 in docs/reference/metricbeat/exported-fields-system.md

View workflow job for this annotation

GitHub Actions / docs-preview / vale

Elastic.WordChoice: Consider using 'run, start' instead of 'execute', unless the term is in the UI.

type: keyword


**`system.core.physical_id`**
: CPU core physical ID. Only availabe on Linux
: CPU core physical ID. Only available on Linux

type: keyword

Expand Down Expand Up @@ -1569,23 +1569,23 @@


**`system.process.cgroup.memory.mem.low.bytes`**
: memory low threshhold
: memory low threshold

type: long

format: bytes


**`system.process.cgroup.memory.mem.high.bytes`**
: memory high threshhold
: memory high threshold

type: long

format: bytes


**`system.process.cgroup.memory.mem.max.bytes`**
: memory max threshhold
: memory max threshold

type: long

Expand Down Expand Up @@ -1657,23 +1657,23 @@


**`system.process.cgroup.memory.memsw.low.bytes`**
: memory low threshhold
: memory low threshold

type: long

format: bytes


**`system.process.cgroup.memory.memsw.high.bytes`**
: memory high threshhold
: memory high threshold

type: long

format: bytes


**`system.process.cgroup.memory.memsw.max.bytes`**
: memory max threshhold
: memory max threshold

type: long

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/packetbeat/add-nomad-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Indexers and matchers are used to correlate fields in events with actual metadat

Indexers use allocation metadata to create unique identifiers for each one of the pods.

Avaliable indexers are:
Available indexers are:

`allocation_name`
: Identifies allocations by its name and namespace (as `<namespace>/<name>`)
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/packetbeat/configuration-ssl.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Controls the verification of server certificates. Valid values are:

### `ca_trusted_fingerprint` [ca_trusted_fingerprint]

A HEX encoded SHA-256 of a CA certificate. If this certificate is present in the chain during the handshake, it will be added to the `certificate_authorities` list and the handshake will continue normaly.
A HEX encoded SHA-256 of a CA certificate. If this certificate is present in the chain during the handshake, it will be added to the `certificate_authorities` list and the handshake will continue normally.

To get the fingerprint from a CA certificate on a Unix-like system, you can use the following command, where `ca.crt` is the certificate.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/winlogbeat/add-nomad-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Indexers and matchers are used to correlate fields in events with actual metadat

Indexers use allocation metadata to create unique identifiers for each one of the pods.

Avaliable indexers are:
Available indexers are:

`allocation_name`
: Identifies allocations by its name and namespace (as `<namespace>/<name>`)
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/winlogbeat/configuration-ssl.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Controls the verification of server certificates. Valid values are:

### `ca_trusted_fingerprint` [ca_trusted_fingerprint]

A HEX encoded SHA-256 of a CA certificate. If this certificate is present in the chain during the handshake, it will be added to the `certificate_authorities` list and the handshake will continue normaly.
A HEX encoded SHA-256 of a CA certificate. If this certificate is present in the chain during the handshake, it will be added to the `certificate_authorities` list and the handshake will continue normally.

To get the fingerprint from a CA certificate on a Unix-like system, you can use the following command, where `ca.crt` is the certificate.

Expand Down
8 changes: 6 additions & 2 deletions filebeat/processor/add_kubernetes_metadata/matchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ func (f *LogPathMatcher) MetadataIndex(event mapstr.M) string {
return ""
}

source := value.(string)
source, ok := value.(string)
if !ok {
f.logger.Debugf("log.file.path is not a string: %T", value)
return ""
}
Comment on lines +91 to +95
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ai, could you add a test for that?

f.logger.Debugf("Incoming log.file.path value: %s", source)

if !strings.Contains(source, f.LogsPath) {
Expand Down Expand Up @@ -128,7 +132,7 @@ func (f *LogPathMatcher) MetadataIndex(event mapstr.M) string {
}
}

f.logger.Error("Error extracting pod uid - source value does not contains matcher's logs_path")
f.logger.Error("Error extracting pod UID - source value does not contain matcher's logs_path")
return ""
}
} else {
Expand Down
46 changes: 46 additions & 0 deletions filebeat/processor/add_kubernetes_metadata/matchers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,26 @@
executeTestWithResourceType(t, cfgLogsPath, cfgResourceType, source, expectedResult)
}

func TestLogsPathMatcher_NonStringLogPath(t *testing.T) {
testConfig := conf.NewConfig()

logger, observedLogs := logptest.NewTestingLoggerWithObserver(t, "")
logMatcher, err := newLogsPathMatcher(*testConfig, logger)
assert.NoError(t, err)

input := mapstr.M{
"log": mapstr.M{
"file": mapstr.M{
"path": 42,
},
},
}
output := logMatcher.MetadataIndex(input)

assert.Equal(t, "", output)

Check failure on line 145 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

empty: use assert.Empty (testifylint)

Check failure on line 145 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (macos-latest)

empty: use assert.Empty (testifylint)

Check failure on line 145 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

empty: use assert.Empty (testifylint)
assert.Len(t, observedLogs.FilterMessageSnippet("log.file.path is not a string: int").TakeAll(), 1)
}

func TestLogsPathMatcher_InvalidVarLogPodSource(t *testing.T) {
cfgLogsPath := "/var/log/pods/"
cfgResourceType := "pod"
Expand Down Expand Up @@ -164,6 +184,32 @@
executeTestWithResourceType(t, cfgLogsPath, cfgResourceType, source, expectedResult)
}

func TestLogsPathMatcher_InvalidVarLogPodIDFormat_LogsPodUIDError(t *testing.T) {
cfgLogsPath := "/var/log/pods/"
cfgResourceType := "pod"
source := fmt.Sprintf("/var/log/pods/%s/container/0.log", puid)

testConfig := conf.NewConfig()
testConfig.SetString("logs_path", -1, cfgLogsPath)

Check failure on line 193 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Error return value of `testConfig.SetString` is not checked (errcheck)

Check failure on line 193 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (macos-latest)

Error return value of `testConfig.SetString` is not checked (errcheck)

Check failure on line 193 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Error return value of `testConfig.SetString` is not checked (errcheck)
testConfig.SetString("resource_type", -1, cfgResourceType)

Check failure on line 194 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Error return value of `testConfig.SetString` is not checked (errcheck)

Check failure on line 194 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (macos-latest)

Error return value of `testConfig.SetString` is not checked (errcheck)

Check failure on line 194 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Error return value of `testConfig.SetString` is not checked (errcheck)

logger, observedLogs := logptest.NewTestingLoggerWithObserver(t, "")
logMatcher, err := newLogsPathMatcher(*testConfig, logger)
assert.NoError(t, err)

input := mapstr.M{
"log": mapstr.M{
"file": mapstr.M{
"path": source,
},
},
}
output := logMatcher.MetadataIndex(input)

assert.Equal(t, "", output)

Check failure on line 209 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

empty: use assert.Empty (testifylint)

Check failure on line 209 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (macos-latest)

empty: use assert.Empty (testifylint)

Check failure on line 209 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

empty: use assert.Empty (testifylint)
assert.Len(t, observedLogs.FilterMessageSnippet("Error extracting pod UID - source value does not contain matcher's logs_path").TakeAll(), 1)
}

func TestLogsPathMatcher_ValidVarLogPod(t *testing.T) {
cfgLogsPath := "/var/log/pods/"
cfgResourceType := "pod"
Expand All @@ -185,7 +231,7 @@
func executeTestWithResourceType(t *testing.T, cfgLogsPath string, cfgResourceType string, source string, expectedResult string) {
testConfig := conf.NewConfig()
if cfgLogsPath != "" {
testConfig.SetString("logs_path", -1, cfgLogsPath)

Check failure on line 234 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Error return value of `testConfig.SetString` is not checked (errcheck)

Check failure on line 234 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (macos-latest)

Error return value of `testConfig.SetString` is not checked (errcheck)

Check failure on line 234 in filebeat/processor/add_kubernetes_metadata/matchers_test.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Error return value of `testConfig.SetString` is not checked (errcheck)
}

if cfgResourceType != "" {
Expand Down
12 changes: 6 additions & 6 deletions metricbeat/module/system/core/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,25 @@
- name: model_number
type: keyword
description: >
CPU model number. Only availabe on Linux
CPU model number. Only available on Linux

- name: model_name
type: keyword
description: >
CPU model name. Only availabe on Linux
CPU model name. Only available on Linux

- name: mhz
type: float
description: >
CPU core current clock. Only availabe on Linux
CPU core current clock. Only available on Linux

- name: core_id
type: keyword
description: >
CPU physical core ID. One core might might execute multiple threads, hence more than
one `system.core.id` can share the same `system.core.core_id`. Only availabe on Linux
CPU physical core ID. One core might execute multiple threads, hence more than
one `system.core.id` can share the same `system.core.core_id`. Only available on Linux

- name: physical_id
type: keyword
description: >
CPU core physical ID. Only availabe on Linux
CPU core physical ID. Only available on Linux
Loading
Loading