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

Merge from yelp/elastalert:master to ensure parity #2

Merged
merged 3 commits into from
Nov 25, 2020

Conversation

jertel
Copy link
Owner

@jertel jertel commented Nov 25, 2020

No description provided.

Qmando and others added 3 commits September 10, 2020 18:05
This has come about because we currently use records which have timestamps like:

```
    "@timestamp": {
      "min": "2020-10-03T07:05:01.987Z",
      "max": "2020-10-05T07:05:09.572Z"
    },
```

These work fine with the `timestamp_field` set to `@timestamp.min`.

However, when we try to create a Jira alert using ElastAlert from these, we run
into a Python error:

```
File "/usr/local/lib/python3.6/site-packages/elastalert/alerts.py", line 875, in create_default_title,
title += ' - %s' % (pretty_ts(matches[0][self.rule['timestamp_field']], self.rule.get('use_local_time'))), KeyError: '@timestamp.min'
```

This is because matches[0][self.rule['timestamp_field']] attempts to access
the `timestamp_field` directly rather than using a `get()`.

The proposed fix will not change any existing behaviour, but will skip the addition
of a timestamp to the ticket title if the required field doesn't exist, rather than
throwing an error and disabling the rule.
Fix the use of timestamps in the Jira ticket titles
@jertel jertel merged commit 015ee1f into jertel:master Nov 25, 2020
jertel pushed a commit that referenced this pull request Nov 18, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants