Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #8703 to 6.x: Add Journalbeat #8739

Merged
merged 2 commits into from
Oct 24, 2018
Merged

Conversation

kvch
Copy link
Contributor

@kvch kvch commented Oct 24, 2018

Cherry-pick of PR #8703 to 6.x branch.

* Initialize Journalbeat (elastic#8277)

This is the first PR to initialize Journalbeat with minimal functionality.

The architecture is mimicing Filebeat so it can be merged into FB in the future. It means it has multiple inputs which can share configuration (`backoff`, `backoff_factor`, etc.). Inputs can have multiple readers, each reader reads from a journal specified in the list of `paths`. The readers are not going to implement the interface `Harverster` until it's merged into Filebeat, because it would overcomplicate event publishing unnecessarily and would need to duplicate too much Filebeat code.

Checkpointing is copied from Winlogbeat. Once the new registry file is merged, it will be migrated.

Example configuration to read from the beginning of the local journal

```yml
journalbeat.inputs:
- paths: []
  seek: head
```

Features
* read from local journal, journal file and directory
* position tracking by using check-pointing as it's done in Winlogbeat
* seek to "tail", "head", "cursor"
* minimal E2E tests
* fields.yml and documentation

Vendored:
* github.com/coreos/go-systemd/sdjournal

* Journalbeat matches support && minor additions (elastic#8324)

From now on it's possible to match for journal entry fields in Journalbeat using the new option `matches`. This requires a list of key value pairs separated by "=". The key has to be a journalbeat event key (e.g systemd.unit) and the value is the exact value journal reader needs to find in the entries.

Example configuration which returns NGINX and dhclient entries from the journal:
```yml
include_matches:
  - "systemd.unit=nginx"
  - "process.name=dhclient"
```
Added docker fields from: https://docs.docker.com/config/containers/logging/journald/
- `container.id`
- `container.id_truncated`
- `container.name`
- `container.image.tag`
- `container.partial`

Journalbeat parses the timestamp of the entry and adds it to the event as `@timestamp`. The time of reading by Journalbeat is saved in `read_timestamp`.

Custom fields by various sources are stored under `custom`. Field names are normalized, meaning `"_"` prefix is removed and every letter is lowercase.

From now on it is possible to configure `processors` and `fields`, etc on `input` level.

The size of each open reader is reporting in bytes:
```
{
  "journalbeat": {
    "journals": {
      "journal_1": {
         "path": "system.journal",
         "size_in_bytes": 123124214,
       }
    }
}
```

* Minor improvements to Journalbeat (elastic#8618)

* Packaging of journalbeat (elastic#8702)

Journalbeat is going to be built using the new Debian 8 container, because systemd version in Debian 7 is too old (v44 instead of the required v187).

Minor changes:
* add missing X-Pack folder to journalbeat
* do not crosscompile journalbeat due to missing dependencies locally

* Add journalbeat docs (elastic#8735)

* Add journalbeat docs

(cherry picked from commit 24d0e08)
)

const (
_FILE_FLAG_WRITE_THROUGH = 0x80000000

Choose a reason for hiding this comment

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

don't use ALL_CAPS in Go names; use CamelCase

.travis.yml Outdated
- os: osx
env: TARGETS="TEST_ENVIRONMENT=0 -C x-pack/functionbeat testsuite"
go: $GO_VERSION
stage: test
Copy link

Choose a reason for hiding this comment

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

I assume this functionbeat reference is wrong here.

@kvch
Copy link
Contributor Author

kvch commented Oct 24, 2018

All relevant jobs are green.

@kvch kvch merged commit e805488 into elastic:6.x Oct 24, 2018
DStape pushed a commit to DStape/beats that referenced this pull request Aug 20, 2019
* Add Journalbeat (elastic#8703)

* Initialize Journalbeat (elastic#8277)

This is the first PR to initialize Journalbeat with minimal functionality.

The architecture is mimicing Filebeat so it can be merged into FB in the future. It means it has multiple inputs which can share configuration (`backoff`, `backoff_factor`, etc.). Inputs can have multiple readers, each reader reads from a journal specified in the list of `paths`. The readers are not going to implement the interface `Harverster` until it's merged into Filebeat, because it would overcomplicate event publishing unnecessarily and would need to duplicate too much Filebeat code.

Checkpointing is copied from Winlogbeat. Once the new registry file is merged, it will be migrated.

Example configuration to read from the beginning of the local journal

```yml
journalbeat.inputs:
- paths: []
  seek: head
```

Features
* read from local journal, journal file and directory
* position tracking by using check-pointing as it's done in Winlogbeat
* seek to "tail", "head", "cursor"
* minimal E2E tests
* fields.yml and documentation

Vendored:
* github.com/coreos/go-systemd/sdjournal

* Journalbeat matches support && minor additions (elastic#8324)

From now on it's possible to match for journal entry fields in Journalbeat using the new option `matches`. This requires a list of key value pairs separated by "=". The key has to be a journalbeat event key (e.g systemd.unit) and the value is the exact value journal reader needs to find in the entries.

Example configuration which returns NGINX and dhclient entries from the journal:
```yml
include_matches:
  - "systemd.unit=nginx"
  - "process.name=dhclient"
```
Added docker fields from: https://docs.docker.com/config/containers/logging/journald/
- `container.id`
- `container.id_truncated`
- `container.name`
- `container.image.tag`
- `container.partial`

Journalbeat parses the timestamp of the entry and adds it to the event as `@timestamp`. The time of reading by Journalbeat is saved in `read_timestamp`.

Custom fields by various sources are stored under `custom`. Field names are normalized, meaning `"_"` prefix is removed and every letter is lowercase.

From now on it is possible to configure `processors` and `fields`, etc on `input` level.

The size of each open reader is reporting in bytes:
```
{
  "journalbeat": {
    "journals": {
      "journal_1": {
         "path": "system.journal",
         "size_in_bytes": 123124214,
       }
    }
}
```

* Minor improvements to Journalbeat (elastic#8618)

* Packaging of journalbeat (elastic#8702)

Journalbeat is going to be built using the new Debian 8 container, because systemd version in Debian 7 is too old (v44 instead of the required v187).

Minor changes:
* add missing X-Pack folder to journalbeat
* do not crosscompile journalbeat due to missing dependencies locally

* Add journalbeat docs (elastic#8735)

* Add journalbeat docs

(cherry picked from commit 24d0e08)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants