-
Notifications
You must be signed in to change notification settings - Fork 152
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
LOG-6236: Align syslog output implementation with spec RFC3164 and RFC5124 #2830
Conversation
Skipping CI for Draft Pull Request. |
source = ''' | ||
. = merge(., parse_json!(string!(.message))) ?? . | ||
|
||
.tag = to_string!(.systemd.u.SYSLOG_IDENTIFIER[.systemd.t.PID] || .systemd.u.SYSLOG_IDENTIFIER || "-") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want the fallback to be empty spaces for all of these. Fluentd used "-" but I do not see where dash is anything in the spec
/test all |
/test all |
@vparfonov: This pull request references LOG-6236 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.8.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
/hold |
}) | ||
} | ||
|
||
if s.ProcId != "" { | ||
if s.ProcId == "" { | ||
s.ProcId = `{._internal.syslog.proc_id || "-"}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My previous comment regarding "default" applies and the reason I really want to hash this out in the document of what the various scenarios look like. IMO the fallback should not be -
; it should be empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes for RFC3164 should be empty, but for RFC5164 -
. I will update
inputs = ["application"] | ||
source = ''' | ||
. = merge(., parse_json!(string!(.message))) ?? . | ||
if .log_type == "infrastructure" && .log_source == "node" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vparfonov There might be logs with .log_type == "infrastructure" that do not have .log_source == "node". As far as I can see, I found that the logs from namespace_name=openshift-kube-apiserver and container_name=kube-apiserver do not have .log_source == "node". This line may need a conditional statement for container logs within the openshift-* namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kattz-kawa Good point, it can be .log_source == "container", but it will be not journal log something closer to application logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the only input to this transform truly is "application" logs, "application" is ever only container logs; it is never sourced from journald. This means we should alter the transforms accordingly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this logic is correct, could simplify slightly :
- if (node) - these are journald logs and we can map the syslog fields exactly from the logs.
Note: 'if (node)' is equivalent to 'if (infra && node)' because all node logs are infra logs.
The difference in format is really node vs. container, not application vs. infra. - if (container) - container logs are formatted the same regardless of type (application or infra)
- if (audit) - audit logs formatted differently from either of the previous two cases.
…C5124 Signed-off-by: Vitalii Parfonov <vparfono@redhat.com>
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
inputs = ["application"] | ||
source = ''' | ||
. = merge(., parse_json!(string!(.message))) ?? . | ||
if .log_type == "infrastructure" && .log_source == "node" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this logic is correct, could simplify slightly :
- if (node) - these are journald logs and we can map the syslog fields exactly from the logs.
Note: 'if (node)' is equivalent to 'if (infra && node)' because all node logs are infra logs.
The difference in format is really node vs. container, not application vs. infra. - if (container) - container logs are formatted the same regardless of type (application or infra)
- if (audit) - audit logs formatted differently from either of the previous two cases.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alanconway, vparfonov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
/unhold |
/retest |
@vparfonov: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
@vparfonov: cannot checkout In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/cherry-pick release-6.1 |
@vparfonov: new pull request created: #2905 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/cherry-pick release-6.0 |
@vparfonov: #2830 failed to apply on top of branch "release-6.0":
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Description
This PR addressed to align Syslog Output with syslog specification RFC3164 and RFC5424
Default values for fields:
RFC3164
Format:
<PRI>TIMESTAMP HOSTNAME TAG: MESSAGE
Example:
<34>Oct 11 22:14:15 mymachine su[1234]: 'su root' failed for lonvick on /dev/pts/
*If
ProcId
available, it will aggregate withAppName
in the.tag
field:appname[procid]
RFC5424
Format:
<PRI> VERSION TIMESTAMP HOSTNAME APP-NAME PROCID MSGID [STRUCTURED-DATA] MESSAGE
Example:
<PRI>1 2024-11-08T14:35:04.123Z ip-10-0-88-196.ec2.internal app-name 1234 ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"] This is a sample message
Changes:
/cc @cahartma @Clee2691
/assign @jcantrill
/cherry-pick
Links