Skip to content

cleanup server-log action#53326

Merged
pmuellr merged 4 commits intoelastic:masterfrom
pmuellr:actions/ensure-single-line
Jan 2, 2020
Merged

cleanup server-log action#53326
pmuellr merged 4 commits intoelastic:masterfrom
pmuellr:actions/ensure-single-line

Conversation

@pmuellr
Copy link
Copy Markdown
Contributor

@pmuellr pmuellr commented Dec 17, 2019

Summary

  • make the level param optional, defaults to info
  • change the actions logger "tag" from "alerting" to "actions"
  • prefix the line logged with server-log:
  • remove control characters from message

- make the level param optional, defaults to info
- change the actions logger "tag" from "alerting" to "actions"
- remove control characters from message
@pmuellr pmuellr added Feature:Alerting v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.6.0 Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// labels Dec 17, 2019
@mikecote
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

@pmuellr
Copy link
Copy Markdown
Contributor Author

pmuellr commented Jan 2, 2020

@elasticmachine merge upstream

const sanitizedMessage = withoutControlCharacters(params.message);
try {
logger[params.level](params.message);
logger[params.level](`server-log: ${sanitizedMessage}`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the prefix seems to be causing a test failure in:

params: { message: 'message text here', level: 'info' },
config: {},
secrets: {},
});
expect(mockedLogger.info).toHaveBeenCalledWith('message text here');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, just pushed a commit with the fix

*/

// see: https://en.wikipedia.org/wiki/Unicode_control_characters
const CONTROL_CHAR_PATTERN = /[\x00-\x1F]|[\x7F-\x9F]|[\u2028-\u2029]/g;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will remove tabs as well? I think that is probably OK, but some might expect that to be valid whitespace.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true; it's likely to confuse customers, so I think we should probably just let that one pass through untranslated

const sanitizedMessage = withoutControlCharacters(params.message);
try {
logger[params.level](params.message);
logger[params.level](`server-log: ${sanitizedMessage}`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe 'server-log' should be pulled out as a symbol, as it is also used in the action type name and id?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

Copy link
Copy Markdown
Contributor

@peterschretlen peterschretlen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM

Copy link
Copy Markdown
Contributor

@mikecote mikecote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@pmuellr pmuellr merged commit 592bc43 into elastic:master Jan 2, 2020
pmuellr added a commit to pmuellr/kibana that referenced this pull request Jan 2, 2020
- make the level param optional, defaults to info
- change the actions logger "tag" from "alerting" to "actions"
- remove control characters from message
pmuellr added a commit that referenced this pull request Jan 3, 2020
- make the level param optional, defaults to info
- change the actions logger "tag" from "alerting" to "actions"
- remove control characters from message
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 3, 2020
* master:
  Rename `/api/security/oidc` to `/api/security/oidc/callback`. (elastic#53886)
  Updating transitive dependencies to use handlebars@4.5.3 (elastic#53899)
  [Reporting/Tests] consolidate functional test configs (elastic#52671)
  [Reporting] Correct the docvalue_fields params in the search query Download CSV from Dashboard Panel (elastic#52833)
  [Test/Newsfeed] Re-enable test and add news item to be filtered (elastic#53905)
  cleanup server-log action (elastic#53326)
  [Uptime] Delete uptime eslint rule skip (elastic#50912)
  [skip-ci] Expression Lifecycle Docs (elastic#51494)
  [Endpoint] add react router to endpoint app (elastic#53808)
  [SIEM][Detection Engine] Silence 409 errors on signal creation (elastic#53859)
  [Maps] get max_result_window and max_inner_result_window from index settings (elastic#53500)
  [ML] New Platform server shim: update analytics routes to use new platform router (elastic#53521)
  fixes typo on engine detection page (elastic#53877)
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 3, 2020
* master:
  Rename `/api/security/oidc` to `/api/security/oidc/callback`. (elastic#53886)
  Updating transitive dependencies to use handlebars@4.5.3 (elastic#53899)
  [Reporting/Tests] consolidate functional test configs (elastic#52671)
  [Reporting] Correct the docvalue_fields params in the search query Download CSV from Dashboard Panel (elastic#52833)
  [Test/Newsfeed] Re-enable test and add news item to be filtered (elastic#53905)
  cleanup server-log action (elastic#53326)
  [Uptime] Delete uptime eslint rule skip (elastic#50912)
  [skip-ci] Expression Lifecycle Docs (elastic#51494)
  [Endpoint] add react router to endpoint app (elastic#53808)
  [SIEM][Detection Engine] Silence 409 errors on signal creation (elastic#53859)
  [Maps] get max_result_window and max_inner_result_window from index settings (elastic#53500)
  [ML] New Platform server shim: update analytics routes to use new platform router (elastic#53521)
  fixes typo on engine detection page (elastic#53877)
  [Maps] push mapbox value extraction from VectorStyle and into DynamicStyleProperty (elastic#53806)
  Fix suggested value for time_zone in range query (elastic#53841)
  Clean up generic hooks, use react-use instead (elastic#53822)
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 3, 2020
…ris/kibana into alerting/created_at-and-updated_at

* 'alerting/created_at-and-updated_at' of github.com:gmmorris/kibana:
  Rename `/api/security/oidc` to `/api/security/oidc/callback`. (elastic#53886)
  Updating transitive dependencies to use handlebars@4.5.3 (elastic#53899)
  [Reporting/Tests] consolidate functional test configs (elastic#52671)
  [Reporting] Correct the docvalue_fields params in the search query Download CSV from Dashboard Panel (elastic#52833)
  [Test/Newsfeed] Re-enable test and add news item to be filtered (elastic#53905)
  cleanup server-log action (elastic#53326)
  [Uptime] Delete uptime eslint rule skip (elastic#50912)
  [skip-ci] Expression Lifecycle Docs (elastic#51494)
  [Endpoint] add react router to endpoint app (elastic#53808)
  [SIEM][Detection Engine] Silence 409 errors on signal creation (elastic#53859)
  [Maps] get max_result_window and max_inner_result_window from index settings (elastic#53500)
  [ML] New Platform server shim: update analytics routes to use new platform router (elastic#53521)
  fixes typo on engine detection page (elastic#53877)
  [Maps] push mapbox value extraction from VectorStyle and into DynamicStyleProperty (elastic#53806)
  Fix suggested value for time_zone in range query (elastic#53841)
  Clean up generic hooks, use react-use instead (elastic#53822)
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 3, 2020
…t-types

* alerting/created_at-and-updated_at:
  updatedAt should equal createdAt on creation
  Move index patterns: src/legacy/core_plugins/data 👉 src/plugins/data (elastic#53794)
  moved Task Manager server code under "server" directory (elastic#53777)
  Rename `/api/security/oidc` to `/api/security/oidc/callback`. (elastic#53886)
  Updating transitive dependencies to use handlebars@4.5.3 (elastic#53899)
  [Reporting/Tests] consolidate functional test configs (elastic#52671)
  [Reporting] Correct the docvalue_fields params in the search query Download CSV from Dashboard Panel (elastic#52833)
  [Test/Newsfeed] Re-enable test and add news item to be filtered (elastic#53905)
  cleanup server-log action (elastic#53326)
  [Uptime] Delete uptime eslint rule skip (elastic#50912)
  [skip-ci] Expression Lifecycle Docs (elastic#51494)
  [Endpoint] add react router to endpoint app (elastic#53808)
  [SIEM][Detection Engine] Silence 409 errors on signal creation (elastic#53859)
  [Maps] get max_result_window and max_inner_result_window from index settings (elastic#53500)
  [ML] New Platform server shim: update analytics routes to use new platform router (elastic#53521)
  fixes typo on engine detection page (elastic#53877)
  [Maps] push mapbox value extraction from VectorStyle and into DynamicStyleProperty (elastic#53806)
  Fix suggested value for time_zone in range query (elastic#53841)
  Clean up generic hooks, use react-use instead (elastic#53822)
@pmuellr pmuellr deleted the actions/ensure-single-line branch January 23, 2020 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v7.6.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants