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

journald filter is ignored if there is a sincedb cursor #25

Open
SpComb opened this issue Oct 5, 2018 · 0 comments · May be fixed by #29
Open

journald filter is ignored if there is a sincedb cursor #25

SpComb opened this issue Oct 5, 2018 · 0 comments · May be fixed by #29

Comments

@SpComb
Copy link

SpComb commented Oct 5, 2018

The configured filter => { ... } only gets applied if there is not cursor stored in the sincedb:

This means that the configured filter works on the first logstash run, but restarting logstash causes the plugin to read in all journald entries, not only the filtered entries.

  • Version: logstash 6.0.0
  • Operating System: Docker docker.elastic.co/logstash/logstash image on RHEL 7
  • Config File (if you have sensitive info, please remove it):
input {
        journald {
                path      => "/run/log/journal"
                sincedb_path    => "/tmp/logstash-test/.sincedb_journal"
                seekto    => "tail"
                lowercase => true
                filter    => {
                        "_SYSTEMD_UNIT" => "docker.service"
                        "_TRANSPORT"    => "journal"
                }
                type      => "docker"
                tags      => [ "journald" ]
        }
}

output {
        stdout { codec => rubydebug }
}
  • Sample Data:
$ docker run --rm --log-driver journald busybox echo test
test
  • Steps to Reproduce:

Run logstash with the sample config, and use docker run --log-driver journald ... to generate a test entry. Observe that only the docker container output is shown in the logstash stdout output.

Restart logstash, and observe that the logstash stdout output now includes all journald events.

Stop logstash, use rm /tmp/logstash-test/.sincedb_journal to clear the sincedb. Restart logstash, and observe that only the Docker container output is visible again.

stoallan added a commit to stoallan/logstash-input-journald that referenced this issue May 17, 2022
This fixes logstash-plugins#25 for both new runs and restarts.
@stoallan stoallan linked a pull request May 17, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant