Commit Graph

1470 Commits

Author SHA1 Message Date
Alexander Reelsen cb7f916485 Watcher: Remove async code in sync code block (elastic/elasticsearch#4506)
Watcher: Remove async code in sync code block

When removing the watch store this code snippet sneaked in.
A call to get a watch in order to find out if it exists was async, but
the code checking the result was called immediately afterwards without
waiting for the result, thus always using the default value.

This also removes some unused code in TriggeredWatchStore.

Original commit: elastic/x-pack-elasticsearch@c47e70bf8a
2017-01-05 10:24:17 +01:00
Tim Vernum c64ad22579 Use Version.compareTo when calculating minimum version (elastic/elasticsearch#4505)
Results from elasticsearch change elastic/elasticsearch#22378 (6ad5486)

Original commit: elastic/x-pack-elasticsearch@73c09657bb
2017-01-05 17:43:10 +11:00
Tim Vernum ca3bbc7da0 [TESTS] Test resolving ldap groups with preloaded attributes (elastic/elasticsearch#4530)
Add a test for the `UserAttributeGroupsResolver` when using attributes provided as a parameter.

(ported from commit elastic/x-pack@ebc62b7, elastic/elasticsearch#4522)

Original commit: elastic/x-pack-elasticsearch@6502fdb801
2017-01-05 17:42:28 +11:00
Chris Earle 3c68e6dd23 Ignore 5m and 15m system load averages in resolver tests so that Mac users can run them
Original commit: elastic/x-pack-elasticsearch@4a2a75b046
2017-01-04 11:59:05 -05:00
Chris Earle 35b405d029 [Monitoring] Add 'logstash' type to old .monitoring-data-2 indices (elastic/elasticsearch#4517)
Add `logstash`, in addition to `kibana` type mappings if they are missing from the _existing_ .monitoring-data-2 indices. This allows existing indices to be upgraded in place to support the Logstash monitoring feature added in 5.2 without having to delete the .monitoring-data-2 index.

Original commit: elastic/x-pack-elasticsearch@864343a116
2017-01-04 00:43:30 -05:00
Chris Earle 0d62207f8f [Monitoring] BWC Allow New Types to be added to .monitoring-data-2 index (elastic/elasticsearch#4504)
* [Monitoring] BWC Allow New Types to be added to .monitoring-data-2 index

This adds the new Logstash (and technically Kibana) types to the index mapping if they're not already there. Pre-existing indices will be blocked from creating new types in the index due to the index setting. The index setting cannot be flipped without opening/closing the index, so manually adding the new types is easier.

Original commit: elastic/x-pack-elasticsearch@e85e800335
2017-01-03 16:47:09 -05:00
javanna cd2e608ecc Remove unused ParseFieldMatcher argument from SearchInput and SearchTransform parse methods
Original commit: elastic/x-pack-elasticsearch@6cf7323961
2017-01-03 22:39:48 +01:00
javanna 4359a0508f remove unused ParseFieldMatcher imports
Original commit: elastic/x-pack-elasticsearch@c5c4834a8b
2017-01-03 22:26:17 +01:00
Jay Modi e41b53c344 roles with FLS and/or DLS are ignored when unlicensed (elastic/elasticsearch#4481)
Currently, roles making use of field or document level security are still applied when
the license level does not enable field and document level security. There is no indication
that these roles are not being applied so it is misleading to users. This change prevents
these roles for applying to authorization and also adds a transient metadata to the response
that indicates which features of a role is unlicensed.

Additionally, this PR prevents the addition or modification of roles to include field or
document level security.

Closes elastic/elasticsearch#2472

Original commit: elastic/x-pack-elasticsearch@c9455958f5
2017-01-03 12:06:33 -05:00
Chris Earle f4b9e794e8 [Monitoring] Fix test that fails with Cgroups missing on some machines
Original commit: elastic/x-pack-elasticsearch@23b7c2a25a
2017-01-03 12:02:12 -05:00
javanna 33653a8865 Remove ParseFieldMatcher usage from SearchRequest
Original commit: elastic/x-pack-elasticsearch@e1b08ab801
2017-01-03 14:48:13 +01:00
Daniel Mitterdorfer dd26c93f68 Eliminate unneccessary declaration of IOException
Original commit: elastic/x-pack-elasticsearch@9f71ff4b55
2017-01-03 12:41:06 +01:00
Christoph Büscher 63baf5a86a Remove Getters and Setters for "minimumNumberShouldMatch" in BoolQueryBuilder
The interval value set is "minimumShouldMatch" and also the documented query dsl
parameter is `minimum_should_match` so we can deprecate
`minimum_number_should_match` and its getters/setters in 5.x and remove them in 6.

Original commit: elastic/x-pack-elasticsearch@53ce64b7b3
2017-01-03 11:29:54 +01:00
Luca Cavanna 3532e34aaa Remove some usages of ParseFieldMatcher in favour of using ParseField directly (elastic/elasticsearch#4495)
Relates to elastic/elasticsearch#19552
Relates to elastic/elasticsearch#22130

Original commit: elastic/x-pack-elasticsearch@85d2a4cdbf
2016-12-31 09:24:35 +01:00
Chris Earle d210213fc9 [Monitoring] Use Cgroup Data from _nodes/stats (elastic/elasticsearch#4484)
* [Monitoring] Use Cgroup Data from _nodes/stats

This adds Cgroup data from _nodes/stats.

- This also adds 5m and 15m from system load, which are sent from ES, but
  were not recorded. Kibana does record/report those values though.

Original commit: elastic/x-pack-elasticsearch@8e04452c60
2016-12-30 18:55:51 -05:00
Chris Earle 2bce702f62 [Monitoring] Add Logstash monitoring feature
This PR adds UI for visualizing Logstash internal metrics with contributions from @ph, @jsvd and @pickypg

Changes include:

* x-pack component for Logstash which installs a monitoring exporter plugin to Logstash core. This periodically ships
  monitoring data to the monitoring bulk API endpoint.
* Adds xpack.monitoring.* setting to logstash.yml when x-pack is installed.
* UI changes to graph Logstash monitoring data. Logstash processes are called nodes. They send separate monitoring info
  which gets aggregated and displayed at cluster level and also at individual node level.
* Adds gradle build support for Logstash x-pack which can be controled via `xpack.logstash.build=false`

Fixes elastic/elasticsearch#4169

Original commit: elastic/x-pack-elasticsearch@f58ef406c1
2016-12-30 10:36:11 -08:00
Luca Cavanna 37a29c0387 Remove some usages of ParseFieldMatcher in favour of using ParseField directly (elastic/elasticsearch#4492)
Relates to elastic/elasticsearch#19552
Relates to elastic/elasticsearch#22130

Original commit: elastic/x-pack-elasticsearch@28f8e3cca4
2016-12-30 18:58:03 +01:00
Jay Modi 39263d83d2 ldap and ad realms should obey the verification_mode setting (elastic/elasticsearch#4486)
When migrating realms to use the new settings for SSL, the removal of the
hostname_verification setting was missed in addition to actually using the
ssl.verification_mode setting. This change deprecates the
hostname_verification and enables the use of the ssl.verification_mode setting.

Original commit: elastic/x-pack-elasticsearch@ea24e83fd3
2016-12-30 10:04:56 -05:00
Jay Modi 18a2cf23d4 Build a single role that represents a user's permissions (elastic/elasticsearch#4449)
This PR changes how we use roles and how we look at the roles of a user. Previously we looked up each role individually, parsed each into their own `Role` object, and had a wrapper that essentially served as an iterator over the roles. The same pattern was also followed for the permissions that composed a role (ClusterPermission, IndicesPermission, and RunAsPermission). This resulted in a lot of code that was hard to follow and could be inefficient. 

Now, we look up the roles for a user in bulk and only get the RoleDescriptor for each role. Once all role descriptors have been retrieved, we build a single Role that represents the user's permissions and we also cache this combination for better performance as authorization can happen many times for a single top level request as we authorize the top level request and any sub requests, which could be a large number in the case of shard requests.

This change also enabled a large cleanup of our permission and privilege classes, which should reduce the footprint of what needs to be followed. Some of the notable changes are:

* Consolidation of GeneralPrivilege and AbstractAutomatonPrivilege into the Privilege class
* The DefaultRole class has been removed and the permissions it provided were moved into the AuthorizationService
* The GlobalPermission class was removed as there is a single role that represents a user's permissions
* The Global inner classes for the various permissions were removed
* The Core inner class was removed and ClusterPermission, IndexPermission, RunAsPermission became final classes instead of interfaces
* The Permission interface has been removed. The isEmpty() method defined by this interface is not needed as we can simply evaluate the permission to get the same effect
* The ClusterPermission#check method only takes the action name again
* The AutomatonPredicate class was removed and replaced by Automatons#predicate
* IndicesAccessControl objects no longer need to be merged when evaluating permissions
* MergedFieldPermissions has been removed
* The Name class that was used to hold an array of strings has been removed and replaced with the use of a Set
* Privilege resolution is more efficient by only combining automata once

Other items:
* NativeRolesStore no longer does caching, so the RoleAndVersion class could be removed
* FileRolesStore doesn't need to be an AbstractLifecycleComponent

Relates elastic/elasticsearch#4327

Original commit: elastic/x-pack-elasticsearch@c1901bc82e
2016-12-30 09:27:49 -05:00
jaymode 9c09b88e9f watcher: do not continue execution when get result doesn't exist
When attempting to a get a watch that does not exist, the listener is called once inside
an if statement and the execution of the method continues as if the watch existed. This
causes failures to happen including a NPE. This commit wraps the execution in a if-else
to prevent this.

Original commit: elastic/x-pack-elasticsearch@27f09852e7
2016-12-30 08:34:39 -05:00
Adrien Grand 2b92ee71bc Fix compilation.
Original commit: elastic/x-pack-elasticsearch@8e845fe3b3
2016-12-30 10:54:20 +01:00
Igor Motov 7597fa8ae9 Use java.nio.charset.StandardCharsets instead of com.google.common.base.Charsets
We are trying to get rid of guava, so it doesn't make much sense to use it as a dependency unless we really need to.

Original commit: elastic/x-pack-elasticsearch@e2e2d58fba
2016-12-29 10:49:40 -05:00
Tim Vernum 22a32c8748 Add logstash_system user to X-Pack security reserved realm
The `logstash_system` user/role are used by logstash internals (e.g. monitoring), and work similarly to the Kibana user and role

Included features:  
- New logstash_system user/role (elastic/elasticsearch#4350, elastic/elasticsearch#4021)
- We no longer hide the reserved roles in the API (applies to both kibana and logstash_system)
- Automatically Disable logstash_system user on upgrade. If upgrading from a pre-5.2.0 version, automatically set the `logstash_system` user to disabled so that the system stays locked down. (elastic/elasticsearch#4445, elastic/elasticsearch#4394)

Closes: elastic/elasticsearch#4021
Closes: elastic/elasticsearch#4394 

Original commit: elastic/x-pack-elasticsearch@a9e6d1f216
2016-12-29 12:36:47 +11:00
Igor Motov 576a512ef2 Remove PROTO-based custom cluster state components
Switches custom cluster state components from PROTO-based de-serialization to named objects based de-serialization

Original commit: elastic/x-pack-elasticsearch@e1be8597ee
2016-12-28 12:38:03 -05:00
Yannick Welsch 505ed14c97 Separate cluster update tasks that are published from those that are not
Companion commit to elastic/elasticsearchelastic/elasticsearch#21912

Original commit: elastic/x-pack-elasticsearch@4ba569f8da
2016-12-23 12:21:59 +01:00
Jason Tedor 935eec54c5 Enable assertions in integration tests
This commit fixes some bugs that were found after enabling assertions in
integration tests.

Relates elastic/elasticsearch#4443

Original commit: elastic/x-pack-elasticsearch@4fdd84166d
2016-12-22 20:14:02 -05:00
Nik Everett 4ff6279865 Remove exception from client suite
Original commit: elastic/x-pack-elasticsearch@51e94561d9
2016-12-22 09:10:42 -05:00
Jason Tedor d5db68702c Adapt to method name change in core
This commit adapts to the change of the method name
ESTestCase#randomPostivieLong to ESTestCase#randomNonNegativeLong.

Original commit: elastic/x-pack-elasticsearch@689429cb54
2016-12-21 23:19:52 -05:00
Nik Everett 483711ed20 Handle removal of IndiciesQueriesRegistry
It has been replaced by `XContentParser#namedObject`.

Original commit: elastic/x-pack-elasticsearch@fd316791a2
2016-12-21 08:01:49 -05:00
Nik Everett b2dc1bdca3 Introduce NamedXContentRegistry (elastic/elasticsearch#4399)
This "super registry" will eventually replace things like
`IndiciesQueriesRegistry` but for now it is just another thing
to plumb across requests.

Original commit: elastic/x-pack-elasticsearch@da26a42b36
2016-12-20 11:05:42 -05:00
Alexander Reelsen 6f7a065605 Watcher: Parse index action results to prevent exceptions (elastic/elasticsearch#4424)
When the index action is used to do some bulk indexing, the single
items of the response were not checked to have been indexed successful.
This could lead to NPEs due to an index response being null when the index
operation had failed. The action was still logged as a success though.

This commit only returns SUCCESS for the action, if all items were indexed
successfully. If all items failed, the result will be FAILED as well. Lastly
the result status PARTIAL_FAILURE is used if there were successful and unsuccessful
index operations.

Additionally some minor cleanups happened, like changing equals/hashcode.

Closes elastic/elasticsearch#4416

Original commit: elastic/x-pack-elasticsearch@692687e1af
2016-12-20 16:53:12 +01:00
Alexander Reelsen 0f8e6354f6 Watcher: Allow deletion of watches regardless of license (elastic/elasticsearch#4414)
The user might want to delete watches on expiry to prevent
further execution, without any actions being executed.

Closes elastic/elasticsearch#4413

Original commit: elastic/x-pack-elasticsearch@244a1b9cd8
2016-12-20 15:26:06 +01:00
Yannick Welsch 68bfc90cea Let ClusterStateObserver only hold onto state that's needed for change detection
Companion commit for elastic/elasticsearchelastic/elasticsearch#21631

Original commit: elastic/x-pack-elasticsearch@3333480707
2016-12-20 15:23:00 +01:00
Alexander Reelsen b994f16f4a Watcher: Ensure non duplicate Wid ids (elastic/elasticsearch#4423)
Removing the WatchLockService could result in duplication of wids, because of a wrong
call to replace underscores with dashes. As UUIDs.createBase64UUID() can contain underscores
but they are kind of reserved in the Wid class due to handling of watch ids, this just uses
the toString() representation of a random UUID.

Closes elastic/elasticsearch#4422

Original commit: elastic/x-pack-elasticsearch@dceb01ae5e
2016-12-20 14:02:00 +01:00
Daniel Mitterdorfer b9a38d9b97 Enable trace logging for LocalExporterTests#testSimpleExport()
This test fails due to a changing cluster state(?).  The
test checks that a local exporter is ready and then continues.
However, during the test, we see output similar to:

skipping exporter [_local] as it isn't ready yet

Which indicates that the cluster state has changed and the
exporter does not return a bulk anymore. Hence, the test is
failing although at one point in time it returned a bulk.

By enabling trace logging we should be able to find out
what's going on.

Original commit: elastic/x-pack-elasticsearch@d7e2200dd9
2016-12-20 08:54:26 +01:00
Ryan Ernst 789df7d2fa Internal: Update signatures for EnvironmentAwareCommand (elastic/elasticsearch#4367)
This is the xplugins side of elastic/elasticsearchelastic/elasticsearch#22175

Original commit: elastic/x-pack-elasticsearch@4359cb1947
2016-12-19 15:23:53 -08:00
javanna adf22c3d24 Adapt to strict parsing mode removal
Original commit: elastic/x-pack-elasticsearch@2d6276a60f
2016-12-19 19:39:08 +01:00
Alexander Reelsen 79a8f27569 Watcher: Remove WatchLockService (elastic/elasticsearch#4365)
The watch lock service is not really needed, as there is already
a data structure that has information about the currently executing
watches, that can be consulted before executed.

This change will now check, if there is already a watch running with
the current id. If there is not, execution will happen as usual. If
there is however, than a watch record will be created, stating that
the watch is currently being executed - which means that it is either
being executed or in the list of planned executions.

This way users can check in the watch history, if a watch has been executed
more often than it should.

In order to easily search for this, a new execution state called
`NOT_EXECUTED_ALREADY_QUEUED` has been added.

Original commit: elastic/x-pack-elasticsearch@867acec3c3
2016-12-19 17:33:48 +01:00
Daniel Mitterdorfer 7a652fa090 Merge pull request elastic/elasticsearch#4398 from danielmitterdorfer/xcontent_strict_duplicate_checks
Enable strict duplicate checks for all XContent types

Original commit: elastic/x-pack-elasticsearch@ad249c2e65
2016-12-19 09:30:19 +01:00
Tim Vernum df7c528c66 Change classification of event_type in index audit trail (elastic/elasticsearch#4375)
In LoggingAuditTrail and the audit-event filtering, we distinguish between single-realm authentication failures ("realm_authentication_failure") and global failures ("authentication_failure").

Update the message output of IndexAuditTrail to reflect this distinction.

Original commit: elastic/x-pack-elasticsearch@56802ae2df
2016-12-19 14:39:21 +11:00
Simon Willnauer c9cfedc3cb [TEST] check if .watches index / alias exists before creating it
Original commit: elastic/x-pack-elasticsearch@74d85121eb
2016-12-18 10:17:43 +01:00
Areek Zillur 278496d5e5 x-pack changes for removing deprecated _suggest endpoint (elasticsearchelastic/elasticsearch#22203)
Original commit: elastic/x-pack-elasticsearch@b9bba20fae
2016-12-16 13:06:35 -05:00
Daniel Mitterdorfer d3c1fbe002 Enable strict duplicate checks for all XContent types
With this commit we enable the Jackson feature 'STRICT_DUPLICATE_DETECTION'
by default for all XContent types (not only JSON).

We have also changed the name of the system property to disable this feature
from `es.json.strict_duplicate_detection` to the now more appropriate name
`es.xcontent.strict_duplicate_detection`.

Relates elastic/elasticsearchelastic/elasticsearch#19614
Relates elastic/elasticsearchelastic/elasticsearch#22073

Original commit: elastic/x-pack-elasticsearch@c92e2a6c55
2016-12-16 13:57:55 +01:00
Alexander Reelsen 0d9cb5f7bd Docs: Updating execution phases of watch execution
Closes elastic/elasticsearch#4079

Original commit: elastic/x-pack-elasticsearch@658ba0a7f7
2016-12-16 11:30:27 +01:00
Boaz Leskes b2972a142c Remove Cluster State Status (elastic/elasticsearch#4313)
A companion PR for https://github.com/elastic/elasticsearch/pull/21817

Original commit: elastic/x-pack-elasticsearch@392235877f
2016-12-15 17:07:02 +01:00
Alexander Reelsen e6ee905931 Watcher: Remove unused class
Original commit: elastic/x-pack-elasticsearch@ecd48b7914
2016-12-15 11:33:36 +01:00
Ryan Ernst 6d4d599f91 Build: Convert xplugins to use new extra projects setup (elastic/elasticsearch#4175)
* Build: Convert xplugins to use new extra projects setup

This change makes the gradle initialization for xplugins look in the
correct location for elasticsearch, which is now as a sibling of an
elasticsearch-extra directory, with x-plugins as a child of the extra
directory.

The elasticsearch side of this change is
elastic/elasticsearchelastic/elasticsearch#21773. This change will enable renaming x-plugins
to x-pack, see elastic/elasticsearch#3643.

Original commit: elastic/x-pack-elasticsearch@09398aea5a
2016-12-14 15:02:28 -08:00
Nik Everett 597ca9275e Finish centralizing XContentParser creation in tests
Now we're ready to add `NamedXContentRegistry`.

Original commit: elastic/x-pack-elasticsearch@c4f6c7c3d6
2016-12-14 11:19:09 -05:00
Daniel Mitterdorfer feabaaf1d6 Add missing import
Original commit: elastic/x-pack-elasticsearch@fbc8eb7ac6
2016-12-14 09:34:55 +01:00
Daniel Mitterdorfer 83240e25b4 Merge remote-tracking branch 'origin/master' into json_strict_duplicate_checks
Original commit: elastic/x-pack-elasticsearch@af25e460d0
2016-12-14 08:53:45 +01:00