-
Notifications
You must be signed in to change notification settings - Fork 979
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
Feat: ECS compliant NAGIOSLOGLINE captures #276
Conversation
that should do thanks. service names are often nagios "internal" e.g.
thing to consider is whether we would use different state labels, which might be confusing, for the 2 mentioned log lines. |
Yes, I think { "service": { "name": "Varnish Backend Connections", "state": "CRITICAL" } 👍 Since these groks don't come with a pipeline, the host checks are a bit tricky though. I think "PING [hostname]" or equivalent could be an appropriate service name in this case. But you can't fill that only with a grok. But I would use |
Everything else makes sense to me 👍 |
for Nagios' host/service state status reports
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.
👍 to just about everything here. Yet again, the field names are really well thought-through, and the additional spec coverage is super useful.
I noticed one weirdness with a spec that anticipates the captured message
being appended onto the existing message
, and would appreciate confirmation that my reasoning is sound. We may benefit from the plain
and lines
codecs being able to capture directly to log.original
in their own ECS modes.
end | ||
|
||
it "generates the nagios_message field" do | ||
expect(grok).to include("nagios_message" => "PING OK - Packet loss = 0%, RTA = 2.24 ms") | ||
if ecs_compatibility? | ||
expect(grok).to include("message" => [message, "PING OK - Packet loss = 0%, RTA = 2.24 ms"]) |
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.
this artifact feels a little weird to me. I assume this is because we are matching on [message]
so a capture appends to the existing message?
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.
Should we encourage people to move the inbound message to log.original
before running grok as a general best practice? I assume that would solve this weirdness.
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, this is a general pattern we're following here when a message
field is to be replaced due ECS.
This is present on other patterns as well that do 'message'
replacement".
Not sure at what point to "fix" this, was mostly thinking grok would eventually run with overwrite => [ "message" ]
. Since this is fairly common pattern, we could adopt overwrite => [ "message" ]
as a default (in ECS mode).
Although I do not like we would have different defaults for a plugin depending on ecs_compatibility
(but there's already a precedence for that in the ES output plugin).
I was thinking the .original
copy could happen "earlier" (on event creation) when using an ECS factory ...
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.
Yeah copying or moving the original payload in the beginning is a good idea. Note however that ECS unfortunately has 2 such fields, log.original
and event.original
. At the next major we're likely to remove log.original
, so I would recommend using event.original
instead. Issue for deprecation/removal is here elastic/ecs#841
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.
since we have Event.new("message" => message)
and "match" => [ "message" => .. ]
hard-coded in spec helper, and also due testing in legacy mode, this seems sufficient for now moving forward.
have added the concern to our meta-issue's post TODO points, as when it gets addressed at a higher level we could get back here and refactor the helpers.
Here I have mostly struggled with getting the naming right - too much "state"/"type" use in Nagios terminology.
Have decided to name "state status" as
status
(previouslynagios_state
) and state type asstate_type
(legacy namenagios_statetype
)The structure is rather flat to mirror Nagios (introducing
state: { type: "..." }
would be an option but the terminology would not follow that well). It's a bit of a compromise, sample capture:p.s. Some of the names were incorrect those have been fixed and specs should clearly reflect the change.
[1427925600] CURRENT HOST STATE: nagioshost;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 2.24 ms
NOTE: now that I looked at ^^^ again I am going to revisit naming once again as the trio feels ackward:
... maybe rename
status -> state
and potentially come up with a better name for thetype