Commit Graph

1765 Commits

Author SHA1 Message Date
Robert Muir b368916005 Use elasticsearch securemock library
Original commit: elastic/x-pack-elasticsearch@0eccff1d6b
2015-06-29 10:46:54 -04:00
Robert Muir ebd515e6ee Use elasticsearch securemock library
Original commit: elastic/x-pack-elasticsearch@b44c85ca99
2015-06-29 10:38:52 -04:00
uboness 7cec0c97df Added time zone support to DynamicIndexName
Today `DynamicIndexName` generates the names based on UTC. This doesn't work for environments where the indices rollover is based on a local/different timezone.

The timezone can be configured:
 * globally with the `watcher.dynamic_indices.time_zone` setting
 * collectively to all `search` input, `search` transform and `index` action with `watcher.input.search.dynamic_indices.time_zone`, `watcher.transform.search.dynamic_indices.time_zone` and `watcher.actions.index.dynamic_indices.time_zone` respectively
 * locally on the watch as part of the `search` input, `search` transform and/or `index` action definition.

This commit revealed a set of bugs in the `search` input, `search` transform and/or `index` action when it comes to xcontent serialization. In short, when the user didn't define a timeout, a default timeout was set on them, which meant their serialized xcontent did not match the original one (from which they're deserialized). This bug also meant that the global default client timeouts (defined in the `ClientProxy` never took effect.

  This issue revealed the bugs above as the `WatchTests` were enhanced to execute more settings permutations

Closes elastic/elasticsearch#632

Original commit: elastic/x-pack-elasticsearch@35a2191828
2015-06-29 15:36:34 +03:00
Martijn van Groningen 0a07d6dee5 index templates: Change the TemplateUtils to be a TemplateRegistry that is responsible for maintaining the Watcher index templates.
The TemplateRegistry adds templates based on if these index templates exist in the cluster state. Components that rely on index templates register their template config with the TemplateRegistry. The TemplateRegistry adds these templates in the background when a cluster state update occurs and add component index settings to the index template. Also when component index settings change, the index template will be updated by the TemplateRegistry.

If a registered index template gets deleted, it will be added back by the TemplateRegistry in background if in a cluster state the index template is missing.

Original commit: elastic/x-pack-elasticsearch@97f4f42160
2015-06-29 12:30:39 +02:00
Martijn van Groningen 521b6e8cf3 lifecycle: Only fork a thread if we start and stop from cluster state update if the watcher state is expected
Also improved some log statements.

Original commit: elastic/x-pack-elasticsearch@7c72550c63
2015-06-26 18:43:17 +02:00
uboness fcad80b973 fixed typo in NOTICE.txt
Original commit: elastic/x-pack-elasticsearch@90bded37ea
2015-06-26 17:02:15 +03:00
uboness a459c753ad Added NOTICE.txt
- added both the `NOTICE.txt` and `LICENSE.txt` to the distribution

Original commit: elastic/x-pack-elasticsearch@5acfd50874
2015-06-26 16:49:28 +03:00
Chris Cowan c43433d580 Merge pull request elastic/elasticsearch#443 from simianhacker/feature/issues
Issues Feature

Original commit: elastic/x-pack-elasticsearch@cefd91100d
2015-06-25 11:15:19 -07:00
Chris Cowan 6c3052d1ab Merge pull request elastic/elasticsearch#437 from panda01/master
Chart and Cluster Status Directives

Original commit: elastic/x-pack-elasticsearch@cd3559db33
2015-06-25 11:14:39 -07:00
Chris Cowan e67359ca09 Merge branch 'master' of github.com:elasticsearch/elasticsearch-marvel into feature/issues
Original commit: elastic/x-pack-elasticsearch@907dc62b0c
2015-06-25 10:15:25 -07:00
uboness 266dfbb3c5 Added version 1.0.0 to WatcherVersion
Original commit: elastic/x-pack-elasticsearch@f7a0996ddf
2015-06-25 16:54:20 +02:00
uboness 39f9f53a0a Renamed the status field in the stored watch
was renamed to `_status` so it'll distinct from the other "formal" fields of the watch and also be aligned with the `_status` field that is returned by the Get API.

Also updated the installation docs

Original commit: elastic/x-pack-elasticsearch@1081b75d13
2015-06-25 15:39:19 +02:00
Martijn van Groningen 9cb7232075 test: Use utc time to create index name in test, since that is what internally is used too.
Original commit: elastic/x-pack-elasticsearch@48f300f657
2015-06-25 00:36:47 +02:00
Martijn van Groningen 193d8092db Added timeout option to the `search` transform, `search` input and `index` action.
Added default timeout setting:
* `watcher.action.index.default_timeout` sets the timeout for `index` action, if no timeout is defined in the `index` action itself.
* `watcher.input.search.default_timeout` sets the timeout for `search` input, if no timeout is defined in the `search` input itself.
* `watcher.transform.search.default_timeout`  sets the timeout for `search` transform, if no timeout is defined in the `search` transform itself.

Added general Watcher wide default timeout settings to the operations exposed in the client proxy:
* `watcher.internal.ops.search.default_timeout` for search related operations.
* `watcher.internal.ops.index.default_timeout` for index operations.
* `watcher.internal.ops.bulk.default_timeout` for bulk operations.

Original commit: elastic/x-pack-elasticsearch@5a3ef35a9d
2015-06-25 00:10:24 +02:00
Martijn van Groningen 591ea500f2 test: Fetch the status from the get response itself instead of the watch source
Original commit: elastic/x-pack-elasticsearch@ab0f4b8fe9
2015-06-24 22:29:17 +02:00
Martijn van Groningen ba17333523 get watch api: Return the watch status separate from the watch source.
The status isn't maintained by the user but rather by Watcher itself. The idea here is that the get watch api should return the watch as was provided to Watcher via the put watch api. The status will be reported under the top level `_status` field.

Original commit: elastic/x-pack-elasticsearch@54e2452493
2015-06-24 21:31:52 +02:00
Martijn van Groningen 67fdad6357 If starting watcher fails, watcher should set itself back to the stopped state.
At the moment if the starting fails watcher will hang in the `starting` phase. This is bad because any subsequent start will be ignored, because the the watcher state isn't `stopped`.

Original commit: elastic/x-pack-elasticsearch@5cbc1d2a13
2015-06-24 21:06:57 +02:00
jaymode 8258cd9f18 add versions 1.2.2 and 1.3.0
Original commit: elastic/x-pack-elasticsearch@b449e20b66
2015-06-24 13:28:26 -04:00
jaymode a7be4867c1 Test: fix exception text assert due to change in es core
Original commit: elastic/x-pack-elasticsearch@c9e711f8c9
2015-06-24 11:45:02 -04:00
uboness b8e80773d9 Fixed the stats API
- now reflects the right stats around the execution threadpool

Original commit: elastic/x-pack-elasticsearch@ecf557c6be
2015-06-24 15:53:06 +02:00
Martijn van Groningen be33ee6323 fixed compile error due to a recent upstream change in core
Original commit: elastic/x-pack-elasticsearch@f09b84c928
2015-06-24 15:11:49 +02:00
Martijn van Groningen d1bc1e1f68 fixed compile error
Original commit: elastic/x-pack-elasticsearch@9675f254c3
2015-06-24 14:04:22 +02:00
uboness bbabf8ba85 fixed build failure
failed due changes in core master

Original commit: elastic/x-pack-elasticsearch@43f6badffe
2015-06-24 12:20:56 +02:00
Martijn van Groningen 26a72e4d21 lifecycle: upon node shutdown make clear it is a manual stop, so that potential cluster states that come in after the LifyCycle#beforeStop can't start watcher.
Original commit: elastic/x-pack-elasticsearch@e2522a21fc
2015-06-24 06:56:01 +02:00
Khalah Jones-Golden b6531876fb [Merge] Merged with latest master
Original commit: elastic/x-pack-elasticsearch@b622a9e74b
2015-06-23 18:02:42 -04:00
Khalah Jones Golden cf6f4422e1 Merge pull request elastic/elasticsearch#438 from simianhacker/master
Refactor Plugin Layout and Settings

Original commit: elastic/x-pack-elasticsearch@c5d8fa0219
2015-06-23 16:51:27 -04:00
Chris Cowan 03380b74e0 Refactor plugin layout; add settings; start issues work
Original commit: elastic/x-pack-elasticsearch@dae4d50d49
2015-06-23 13:45:52 -07:00
uboness c4dbb8d794 [cleanup] index names parser
Was bound in guice without a reason.

Original commit: elastic/x-pack-elasticsearch@75a9b66946
2015-06-23 17:58:45 +02:00
Martijn van Groningen d46dad18d0 Added logging in case state is unexpected when starting or stopping.
Also increased test logging in BootStrapTests.

Original commit: elastic/x-pack-elasticsearch@6b8141dbc0
2015-06-23 16:15:50 +02:00
uboness 71aa3a8059 Added Dynamic Index Names Support
The search input/transform rely on users configuring the search requests. Sometimes (often), these search requests are executed on time-based indices. The problem the

Until now, there's no way to define dynamic index names that are bound to time, which forces the request to search all the indices (for example, the Marvel watches se

This commit adds dynamic index name resolution. It works in the following way:

- and index name can be a simple string (indicating the static/absolute index name you're searching, incl. wildcards)
- an index name can also be a template. The template is enclosed within `<` and `>` (these are officially illegal characters for index names, so these are safe to use)
- the template can have both static parts to it and place holder parts. The place holders are enclosed within `{` and `}`. The place holder holds `date math` expression
 * `"<.marvel-{now}>"` will resolve to `".marvel-2022.03.03"` (the default date format is `YYYY.MM.dd`)
 * `"<.marvel-{now/M}>"` will resolve to `".marvel-2022.03.01"`
 * `"<.marvel-{now{YYYY.MM}}>"` will resolve to `".marvel-2022.03"` (this one has a custom date format - `YYYY.MM`)
 * `"<.marvel-{now/M-1M{YYYY.MM}}>"` will resolve to `".marvel-2022.02"`

The following is an example of a search input that searches marvel indices for the last 3 days (relies on the default Marvel indices format - `.marvel-YYYY.MM.dd`):

```
{
    ...
    "input" : {
            "search" : {
                    "request" : {
                            "indices" : [
                                    "<.marvel-{now/d-2d}>",
                                    "<.marvel-{now/d-1d}>",
                                    "<.marvel-{now/d}>"
                            ],
                            ...
                    }
            }
    }
    ...
}
```

- `index` action was also updated to work with a dynamic index name (e.g. it's possible to index into daily indices by setting the index name to `<idx-{now}>`)

Original commit: elastic/x-pack-elasticsearch@9c15a96029
2015-06-23 15:54:45 +02:00
jaymode d65bfd1721 use doc_values for most fields in audit indices
This changes the mappings for the audit indices to use doc_values for all fields
other than the request_body, which will have a lot of variance. Additionally, the
request_body field is no longer indexed.

Closes elastic/elasticsearch#918

Original commit: elastic/x-pack-elasticsearch@4917529ffa
2015-06-23 09:40:27 -04:00
Martijn van Groningen d2d1c44d07 test: increased test logging
Original commit: elastic/x-pack-elasticsearch@455892c628
2015-06-23 15:31:06 +02:00
uboness 5daddf3fc1 Fixed version scheme
- Lowercase `beta` and `rc`
- use `-beta` and `-rc` suffixes instead of `.beta`and `.rc`

Original commit: elastic/x-pack-elasticsearch@74860d8252
2015-06-23 11:40:34 +02:00
Martijn van Groningen 075e6caba0 logging: if starting watcher fails this should be more visible
Original commit: elastic/x-pack-elasticsearch@26da9d7661
2015-06-23 08:42:56 +02:00
jaymode f0d5c2da61 make addition of message to the bulk processor asynchronous
The index audit trail is currently using a BulkProcessor directly, which under
certain conditions can result in a deadlock. This occurs when the BulkProcessor
is executing a bulk request that triggers another request on the same node and
a flush of the BulkProcessor is also triggered at the same time. The flush
operation holds the lock on the bulk processor but block on acquiring a permit
from the semaphore. The request that was triggered by the bulk request blocks
the release of the semaphore permit since it needs to add a new audit message
to the BulkProcessor.

This commit works around this issue by making use of a bounded queue between the
index audit trail and the BulkProcessor with a consumer thread that handles the
add calls to the BulkProcessor.

Additionally, a new state, INITIALIZED, was added for the lifecycle of the index
audit trail. This is needed for tests since the audit trail can stop, a new
cluster state update is received, and the ShieldLifecycleService will restart the
index audit trail. At the end of the tests, the test infrastructure interrupts all
the threads and this was causing tests to fail with a InterruptedException.

Finally, the test infrastructure was also deleting the template for the index audit
logs, so this commit adds the necessary logic to prevent the deletion of this
template.

Closes elastic/elasticsearch#920

Original commit: elastic/x-pack-elasticsearch@f1b0b47b99
2015-06-22 16:34:23 -04:00
jaymode 9fcd68c8f4 always store origin type and request content for rest requests
The change fixes two bugs in the index audit trail implementation. The first is that
we did not always store the origin type with rest requests. The second is that a
conditional statement controlled the storage of the rest requests content, but the
conditional was based on a log level that had nothing to do with the index based
audit implementation.

Closes elastic/elasticsearch#932

Original commit: elastic/x-pack-elasticsearch@b309e261c3
2015-06-22 15:05:34 -04:00
jaymode 4e11cbebad remove _timestamp from audit index mapping
we're not using the _timestamp field and the path option is no longer supported
in elasticsearch 2.0 so this commit removes the field from the mapping.

Original commit: elastic/x-pack-elasticsearch@399d835d1f
2015-06-22 14:54:37 -04:00
Simon Willnauer 58bd0cc509 [TEST] Remove awaits-fix, the issue is resovled in es-core master
Original commit: elastic/x-pack-elasticsearch@eb813e83dd
2015-06-22 12:54:03 +02:00
uboness 3cf6b32f6a [cleanup] XContentSource now requires XContentType
We need this as the `XContentSource` supports all xcontent constructs as the root construct, while xcontent in core only supports objects. For this reason, we can't rely on xcontent auto-detection of the xcontent type. We need to be explicit about it.

Original commit: elastic/x-pack-elasticsearch@a2ed944a21
2015-06-22 12:24:56 +02:00
Simon Willnauer 797945b586 [TEST] Beef up test to sometimes pass a plain number as a string
Original commit: elastic/x-pack-elasticsearch@f42662c719
2015-06-22 12:11:17 +02:00
Simon Willnauer 5ea2d0528c Require units for all time values
This commit is a backwards compatibilty break for all watcher indices
that had a `throttel_period` set on their watches. `throttle_period` used
to be a numeric value but now is stored as a string AND requires a unit
like seconds or minutes etc. to prevent errors. All other time valiues like
http timeouts also require units now.

Closes elastic/elasticsearch#598

Original commit: elastic/x-pack-elasticsearch@e3b2c2a4af
2015-06-22 11:47:37 +02:00
uboness 5766c64f94 added support for 1.0.0-rc1 in WatcherVersion
Original commit: elastic/x-pack-elasticsearch@02c018c0b9
2015-06-19 15:51:22 +02:00
uboness fa57b2c78e removed javax.mail from test dependencies
Original commit: elastic/x-pack-elasticsearch@294f461456
2015-06-19 11:45:57 +02:00
uboness b4342d6bd4 changed version number to the new scheme
- lowercase `beta` and `rc`
- replaced `.betaXXX` and `.rcXXXX` suffix with `-betaXXX` and `-rcXXX`

Original commit: elastic/x-pack-elasticsearch@843d01c647
2015-06-19 11:26:12 +02:00
uboness fad95315fb remove @Repeat annotation from test
Original commit: elastic/x-pack-elasticsearch@d5414a32e8
2015-06-19 01:46:32 +02:00
jaymode d302b04256 rename shield audit indices to keep naming consistent
This change renames the shield audit indices to keep naming consistent with other plugins.
The name of the index uses '_' to separate words, a '-' to separate the prefix from the time
portion, and '.'s to separate the different portions of the date.

Closes elastic/elasticsearch#925

Original commit: elastic/x-pack-elasticsearch@8ca6856e4a
2015-06-18 15:53:51 -04:00
uboness d41815ca18 fixed version scheme in WatcherVersion
Original commit: elastic/x-pack-elasticsearch@1007cd71a3
2015-06-18 21:50:39 +02:00
jaymode bf9a8024ca Test: remove @Repeat instead of suppressing
Original commit: elastic/x-pack-elasticsearch@cc61a9d14a
2015-06-18 15:06:25 -04:00
Simon Willnauer bc4ce6f153 Remove @Repeat - don't commit hardcoded repeats
Original commit: elastic/x-pack-elasticsearch@e9de83bb3a
2015-06-18 20:59:46 +02:00
jaymode 0533b55dbc Test: add SuppressForbidden for tests with @Repeat
Original commit: elastic/x-pack-elasticsearch@41247fa507
2015-06-18 14:55:33 -04:00