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

Review/refine structured logging field names #379

Open
atc0005 opened this issue Oct 12, 2021 · 1 comment
Open

Review/refine structured logging field names #379

atc0005 opened this issue Oct 12, 2021 · 1 comment
Assignees
Labels
question Further information is requested
Milestone

Comments

@atc0005
Copy link
Owner

atc0005 commented Oct 12, 2021

Background

Currently we're using rs/zerolog to generate JSON formatted, leveled and structured log messages. These messages contain structured logging fields that have have a mostly standardized base collection of fields, but each plugin also adds its own. Most are specific to its use, but there is likely some duplication as well.

In addition to the problem of potential duplication, there is also the issue of inconsistent field names across plugins. In one, we may have virtual_machines as a field name, while in another vms for the same purpose.

Example:

log.Debug().
    Str("vms_filtered_by_name", strings.Join(vsphere.VMNames(filteredVMs), ", ")).
    Int("vms_excluded_by_name", numVMsExcludedByName).
    Msg("VMs after name filtering")

We have a CSV list of VM names that passes named-based filtering, then we have a count of VMs that were excluded based on that filtering.

I'm not sure yet how to handle a mix of field names where one value is a count of items while another is a CSV listing of items.

I should note that normal output from plugins in this project is intended to go to stdout where Nagios will capture it and use the information in the web UI and notifications, whereas log output goes to stderr and (aside from Icinga as noted in #314) is ignored by the monitoring system. While the output is intended for troubleshooting purposes, I'd still like the field names to have some consistency as they're likely to end up matching the performance data field names closely (which are intended for exposure under normal operation).

Questions

  • Should we use a *_list suffix for the CSV list?
    • e.g., vms_list_filtered_by_name or vms_filtered_by_name_list
  • Should we convert the CSV list to a JSON array of values?
  • Should we prefix field names for a numeric value with num_*?
    • e.g., num_vms_excluded_by_name
@atc0005 atc0005 added the question Further information is requested label Oct 12, 2021
@atc0005 atc0005 added this to the Future milestone Oct 12, 2021
@atc0005 atc0005 self-assigned this Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant