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

Rename journalctl to journald #502

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TBD: throughput on production servers.

## Plugins

**Input**: [dmesg](plugin/input/dmesg/README.md), [fake](plugin/input/fake/README.md), [file](plugin/input/file/README.md), [http](plugin/input/http/README.md), [journalctl](plugin/input/journalctl/README.md), [k8s](plugin/input/k8s/README.md), [kafka](plugin/input/kafka/README.md)
**Input**: [dmesg](plugin/input/dmesg/README.md), [fake](plugin/input/fake/README.md), [file](plugin/input/file/README.md), [http](plugin/input/http/README.md), [journald](plugin/input/journald/README.md), [k8s](plugin/input/k8s/README.md), [kafka](plugin/input/kafka/README.md)

**Action**: [add_file_name](plugin/action/add_file_name/README.md), [add_host](plugin/action/add_host/README.md), [convert_date](plugin/action/convert_date/README.md), [convert_log_level](plugin/action/convert_log_level/README.md), [debug](plugin/action/debug/README.md), [discard](plugin/action/discard/README.md), [flatten](plugin/action/flatten/README.md), [join](plugin/action/join/README.md), [join_template](plugin/action/join_template/README.md), [json_decode](plugin/action/json_decode/README.md), [json_encode](plugin/action/json_encode/README.md), [keep_fields](plugin/action/keep_fields/README.md), [mask](plugin/action/mask/README.md), [modify](plugin/action/modify/README.md), [parse_es](plugin/action/parse_es/README.md), [parse_re2](plugin/action/parse_re2/README.md), [remove_fields](plugin/action/remove_fields/README.md), [rename](plugin/action/rename/README.md), [set_time](plugin/action/set_time/README.md), [throttle](plugin/action/throttle/README.md)

Expand Down
2 changes: 1 addition & 1 deletion _sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- [fake](plugin/input/fake/README.md)
- [file](plugin/input/file/README.md)
- [http](plugin/input/http/README.md)
- [journalctl](plugin/input/journalctl/README.md)
- [journald](plugin/input/journald/README.md)
- [k8s](plugin/input/k8s/README.md)
- [kafka](plugin/input/kafka/README.md)

Expand Down
2 changes: 1 addition & 1 deletion cmd/file.d/file.d.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
_ "github.com/ozontech/file.d/plugin/input/fake"
_ "github.com/ozontech/file.d/plugin/input/file"
_ "github.com/ozontech/file.d/plugin/input/http"
_ "github.com/ozontech/file.d/plugin/input/journalctl"
_ "github.com/ozontech/file.d/plugin/input/journald"
_ "github.com/ozontech/file.d/plugin/input/k8s"
_ "github.com/ozontech/file.d/plugin/input/kafka"
_ "github.com/ozontech/file.d/plugin/output/clickhouse"
Expand Down
2 changes: 1 addition & 1 deletion cmd/file.d/file.d_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Plugins registered automatically after importing by init() function:

Moving plugin in sub dir in plugin dir will quit registration quietly.
To prevent this let's check that DefaultPluginRegistry contains all plugins.
Plugins "dmesg", "journalctl" linux based, they contain tag: //go:build linux.
Plugins "dmesg", "journald" linux based, they contain tag: //go:build linux.
We don't check them.
*/
func TestThatPluginsAreImported(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Images are available
on [GitHub container registry](https://github.com/ozontech/file.d/pkgs/container/file.d/versions?filters%5Bversion_type%5D=tagged).

**Note**:
If you are using [journalctl](https://github.com/ozontech/file.d/tree/master/plugin/input/journalctl) input plugin, we
If you are using [journald](https://github.com/ozontech/file.d/tree/master/plugin/input/journald) input plugin, we
recommend choosing the ubuntu version that matches the host machine
version.
For example, if the host machine with which you want to collect logs using journald has a version of Ubuntu 18.04, you
Expand Down
2 changes: 1 addition & 1 deletion e2e/start_work_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
_ "github.com/ozontech/file.d/plugin/input/fake"
_ "github.com/ozontech/file.d/plugin/input/file"
_ "github.com/ozontech/file.d/plugin/input/http"
_ "github.com/ozontech/file.d/plugin/input/journalctl"
_ "github.com/ozontech/file.d/plugin/input/journald"
_ "github.com/ozontech/file.d/plugin/input/k8s"
_ "github.com/ozontech/file.d/plugin/input/kafka"
_ "github.com/ozontech/file.d/plugin/output/clickhouse"
Expand Down
4 changes: 2 additions & 2 deletions plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ curl "localhost:9200/_bulk" -H 'Content-Type: application/json' -d \
```

[More details...](plugin/input/http/README.md)
## journalctl
## journald
Reads `journalctl` output.

[More details...](plugin/input/journalctl/README.md)
[More details...](plugin/input/journald/README.md)
## k8s
It reads Kubernetes logs and also adds pod meta-information. Also, it joins split logs into a single event.

Expand Down
4 changes: 2 additions & 2 deletions plugin/input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ curl "localhost:9200/_bulk" -H 'Content-Type: application/json' -d \
```

[More details...](plugin/input/http/README.md)
## journalctl
## journald
Reads `journalctl` output.

[More details...](plugin/input/journalctl/README.md)
[More details...](plugin/input/journald/README.md)
## k8s
It reads Kubernetes logs and also adds pod meta-information. Also, it joins split logs into a single event.

Expand Down
3 changes: 0 additions & 3 deletions plugin/input/journalctl/init.go

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions plugin/input/journald/init.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package journald

// this file used to import journald plugin without errors on the darwin platform
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build linux

package journalctl
package journald

import (
"strings"
Expand Down Expand Up @@ -28,9 +28,9 @@ type Plugin struct {

// plugin metrics

offsetErrorsMetric *prometheus.CounterVec
journalCtlStopErrorMetric *prometheus.CounterVec
readerErrorsMetric *prometheus.CounterVec
offsetErrorsMetric *prometheus.CounterVec
journalDStopErrorMetric *prometheus.CounterVec
readerErrorsMetric *prometheus.CounterVec
}

type Config struct {
Expand Down Expand Up @@ -65,14 +65,14 @@ func (o *offsetInfo) set(cursor string) {
}

func (p *Plugin) Write(bytes []byte) (int, error) {
p.params.Controller.In(0, "journalctl", p.currentOffset, bytes, false)
p.params.Controller.In(0, "journald", p.currentOffset, bytes, false)
p.currentOffset++
return len(bytes), nil
}

func init() {
fd.DefaultPluginRegistry.RegisterInput(&pipeline.PluginStaticInfo{
Type: "journalctl",
Type: "journald",
Factory: Factory,
})
}
Expand Down Expand Up @@ -108,16 +108,16 @@ func (p *Plugin) Start(config pipeline.AnyConfig, params *pipeline.InputPluginPa
}

func (p *Plugin) registerMetrics(ctl *metric.Ctl) {
p.offsetErrorsMetric = ctl.RegisterCounter("input_journalctl_offset_errors", "Number of errors occurred when saving/loading offset")
p.journalCtlStopErrorMetric = ctl.RegisterCounter("input_journalctl_stop_errors", "Total journalctl stop errors")
p.readerErrorsMetric = ctl.RegisterCounter("input_journalctl_reader_errors", "Total reader errors")
p.offsetErrorsMetric = ctl.RegisterCounter("input_journald_offset_errors", "Number of errors occurred when saving/loading offset")
p.journalDStopErrorMetric = ctl.RegisterCounter("input_journald_stop_errors", "Total journald stop errors")
p.readerErrorsMetric = ctl.RegisterCounter("input_journald_reader_errors", "Total reader errors")
}

func (p *Plugin) Stop() {
err := p.reader.stop()
if err != nil {
p.journalCtlStopErrorMetric.WithLabelValues().Inc()
p.logger.Error("can't stop journalctl cmd", zap.Error(err))
p.journalDStopErrorMetric.WithLabelValues().Inc()
p.logger.Error("can't stop journald cmd", zap.Error(err))
}

offsets := *p.offInfo.Load()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build linux

package journalctl
package journald

import (
"path/filepath"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build linux

package journalctl
package journald

import (
"bufio"
Expand Down