StackStorm / StackStorm/st2

GELF logs do not properly render short_message

Open
#4,462 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

The short_message for GelfFormat logs does not properly render variables. It logs things like Validating rule %s for %s - i.e. it literally uses %s. full_message is logged correctly.

ISSUE TYPE
  • Bug Report
STACKSTORM VERSION

st2 2.9.1, on Python 2.7.12

OS / ENVIRONMENT / INSTALL METHOD

Ansible install, on Ubuntu 16.04.

STEPS TO REPRODUCE

Change the log configuration for ST2 services as documented here. Configure Fluentd to read those GELF-format logs, and send them to Elastic Stack. View the results in Kibana.

EXPECTED RESULTS

I expected to see properly formatted logs, with variables correctly rendered.

ACTUAL RESULTS

The short_message is not properly rendered. For example, when a rule is validated (https://github.com/StackStorm/st2/blob/master/st2reactor/st2reactor/rules/filter.py#L72), it calls the logger:

        LOG.info('Validating rule %s for %s.', self.rule.ref, self.trigger['name'],
                 extra=self._base_logger_context)

This result in a log message like this

Note these fields:

"short_message": "Validating rule %s for %s."
"full_message": "Validating rule mypack.myrule for webhook.",

I expect that short_message should also be rendering %s as the actual variable.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at st2reactor/st2reactor/rules/filter.py around line 72, then trace the GelfFormat logging path that produces short_message and full_message. Reproduce the documented GELF configuration and verify that short_message renders the rule reference and trigger name instead of retaining the %s placeholders.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.