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

[Filebeat] Journald event format changed #30031

Closed
andrewkroh opened this issue Jan 26, 2022 · 8 comments · Fixed by #30057 or #30167
Closed

[Filebeat] Journald event format changed #30031

andrewkroh opened this issue Jan 26, 2022 · 8 comments · Fixed by #30057 or #30167
Labels
bug Filebeat Filebeat Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Comments

@andrewkroh
Copy link
Member

While testing the journald input from master I found that the event format changed from what it produced in 7.x. I don't think this was intentional. It no longer translates the field names as described in the docs.

{
  "@timestamp": "2022-01-26T15:45:33.876Z",
  "@metadata": {
    "beat": "filebeat",
    "type": "_doc",
    "version": "8.1.0"
  },
  "_HOSTNAME": "ubuntu",
  "agent": {
    "ephemeral_id": "487ca4cf-400e-4b10-93ac-dd181aa48a04",
    "id": "30326e16-e7ec-4db4-ace4-6afabefc84cb",
    "name": "ubuntu-impish",
    "type": "filebeat",
    "version": "8.1.0"
  },
  "host": {
    "name": "ubuntu-impish"
  },
  "PRIORITY": "6",
  "_MACHINE_ID": "d0bf0d000d034a4e93307255268a3a69",
  "_TRANSPORT": "kernel",
  "ecs": {
    "version": "8.0.0"
  },
  "_BOOT_ID": "b8d3fca6f9f44ad1acdefef51ce2b8b7",
  "_SOURCE_MONOTONIC_TIMESTAMP": "389271",
  "tags": [
    "NEW"
  ],
  "message": "Kprobes globally optimized",
  "SYSLOG_FACILITY": "0",
  "SYSLOG_IDENTIFIER": "kernel",
  "input": {
    "type": "journald"
  }
}
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jan 26, 2022
@andrewkroh andrewkroh added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Jan 26, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jan 26, 2022
belimawr added a commit to belimawr/beats that referenced this issue Jan 27, 2022
`Message.ToEvent` was not copying the `Message.Privage` field when
converting a Message to `beat.Event`. This commit fixes it.

Fixes: elastic#30031
belimawr added a commit that referenced this issue Jan 28, 2022
`Message.ToEvent` was not copying the `Message.Privage` field when
converting a Message to `beat.Event`. This commit fixes it.

Fixes: #30031
mergify bot pushed a commit that referenced this issue Jan 28, 2022
`Message.ToEvent` was not copying the `Message.Privage` field when
converting a Message to `beat.Event`. This commit fixes it.

Fixes: #30031
(cherry picked from commit 8cc07dd)
@andrewkroh
Copy link
Member Author

@belimawr Did you test that your change fixes this issue?

belimawr added a commit that referenced this issue Jan 28, 2022
`Message.ToEvent` was not copying the `Message.Privage` field when
converting a Message to `beat.Event`. This commit fixes it.

Fixes: #30031
(cherry picked from commit 8cc07dd)

Co-authored-by: Tiago Queiroz <[email protected]>
@belimawr
Copy link
Contributor

@belimawr Did you test that your change fixes this issue?

Yes I did ;)

@andrewkroh andrewkroh reopened this Jan 31, 2022
@andrewkroh
Copy link
Member Author

I tested from 522c862 and still see the original journald field names rather than the translated names.

{
  "@timestamp": "2022-01-13T00:17:01.964Z",
  "@metadata": {
    "beat": "filebeat",
    "type": "_doc",
    "version": "8.1.0"
  },
  "_MACHINE_ID": "28c5bf41aa984b5889fbc9de96f504c0",
  "_SOURCE_MONOTONIC_TIMESTAMP": "1840802579931",
  "PRIORITY": "7",
  "SYSLOG_FACILITY": "0",
  "SYSLOG_IDENTIFIER": "kernel",
  "agent": {
    "version": "8.1.0",
    "ephemeral_id": "8884a04c-5406-45e5-b7e2-fb924f990910",
    "id": "095e9e1e-b7dc-4f69-b782-4fefa529b064",
    "name": "ubuntu-impish",
    "type": "filebeat"
  },
  "ecs": {
    "version": "8.0.0"
  },
  "input": {
    "type": "journald"
  },
  "host": {
    "name": "ubuntu-impish"
  },
  "_HOSTNAME": "compute04.hc.va.local.example.com",
  "_BOOT_ID": "c2f79f985830406a9e08241d015eff05",
  "_TRANSPORT": "kernel",
  "message": "iptables DROP_INPUT: IN=eth1 OUT= MAC=33:33:00:00:00:01:b4:fb:e4:10:0b:51:86:dd SRC=fe80:0000:0000:0000:b6fb:e4ff:fe10:0b51 DST=ff02:0000:0000:0000:0000:0000:0000:0001 LEN=234 TC=0 HOPLIMIT=1 FLOWLBL=232529 PROTO=UDP SPT=35624 DPT=10001 LEN=194 ",
  "tags": [
    "OLD"
  ]
}

@andrewkroh
Copy link
Member Author

andrewkroh commented Jan 31, 2022

The linter is giving hints.

$ pwd
/home/vagrant/go/src/github.com/elastic/beats/filebeat/input/journald

$ golangci-lint run -v --build-tags=withjournald ./...
conv.go:31:6: func `eventFromFields` is unused (unused)

@belimawr
Copy link
Contributor

belimawr commented Feb 1, 2022

I see it now. I fixed the cursor issue you mentioned here, but missed the translation of the fields 🤦‍♂️ Sorry for the confusion!

I'll look at this translation issue now.

@belimawr
Copy link
Contributor

belimawr commented Feb 1, 2022

I found the issue with the translation of the fields, when introducing the multiline parser I changed the way the entry is converted into a beat.Event, the new one does not do this name translation. I'll fix that tomorrow. It seem the current tests on beats focus on the message field, so they didn't break. I'll make sure to add some tests to cover this bug.

@belimawr
Copy link
Contributor

belimawr commented Feb 2, 2022

@andrewkroh here is the fix: #30167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Filebeat Filebeat Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
3 participants